Skip to content

Commit 94e5555

Browse files
committed
Setup paper and famous packages, built loader.
1 parent efa8c64 commit 94e5555

File tree

14 files changed

+191
-158
lines changed

14 files changed

+191
-158
lines changed

.meteor/packages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ standard-app-packages
77
autopublish
88
insecure
99
preserve-inputs
10+
paper
File renamed without changes.

client/app.js

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
Famous.loaded(function (require) {
2+
var Engine = require('famous/Engine'),
3+
Modifier = require('famous/Modifier'),
4+
Matrix = require('famous/Matrix'),
5+
View = require('famous/View'),
6+
SpringTransition = require('famous-physics/utils/SpringTransition'),
7+
Transitionable = require('famous/Transitionable'),
8+
LightBox = require('famous-views/LightBox'),
9+
Time = require('famous-utils/Time');
10+
11+
var CoverData = [
12+
{
13+
text: 'Objects in the mirror are unluckier than they appear.',
14+
img: 'covers/sochi.jpg',
15+
name: 'Steve Kuzminski'
16+
},
17+
{
18+
text: 'Kylie Wilson changed her profile picture',
19+
img: 'covers/sochi.jpg',
20+
name: 'Kylie Wilson'
21+
},
22+
{
23+
text: 'Sick gifs from Sochi',
24+
img: 'covers/sochi.jpg',
25+
name: 'Chris Zimmerman'
26+
}
27+
];
28+
29+
Transitionable.registerMethod('spring', SpringTransition);
30+
31+
//AppView
32+
function AppView() {
33+
View.apply(this, arguments);
34+
this.storiesView = new Paper.StoriesView;
35+
36+
this.lightbox = new LightBox({
37+
inTransform: Matrix.identity,
38+
inOpacity: 0,
39+
inOrigin: [.5, .5],
40+
outTransform: Matrix.identity,
41+
outOpacity: 0,
42+
outOrigin: [.5, .5],
43+
showTransform: Matrix.identity,
44+
showOpacity: 1,
45+
showOrigin: [.5, .5],
46+
inTransition: {
47+
duration: 1e3
48+
},
49+
outTransition: {
50+
duration: 1e3
51+
},
52+
overlap: !0
53+
});
54+
55+
this.covers = [];
56+
57+
for (var t = 0; t < CoverData.length; t++) {
58+
var cover = new Paper.CoverView(CoverData[t]);
59+
this.covers.push(cover);
60+
}
61+
62+
this.lightbox.show(this.covers[0]);
63+
var coverIndex = 0;
64+
Time.setInterval(function () {
65+
coverIndex++;
66+
67+
if (coverIndex === this.covers.length)
68+
coverIndex = 0;
69+
70+
this.lightbox.show(this.covers[coverIndex]);
71+
}.bind(this), 4e3);
72+
73+
var e = new Modifier({
74+
transform: Matrix.translate(0, 0, -.1)
75+
});
76+
77+
this._add(e).link(this.lightbox);
78+
this._add(this.storiesView);
79+
}
80+
81+
AppView.prototype = Object.create(View.prototype);
82+
AppView.prototype.constructor = AppView;
83+
AppView.DEFAULT_OPTIONS = {};
84+
85+
var Context = Engine.createContext();
86+
var appView = new AppView();
87+
88+
Context.link(appView);
89+
Context.setPerspective(2000);
90+
});

packages/famous/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.build*
File renamed without changes.

packages/famous/famous_wrapper.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var onLoad = [];
2+
3+
//XXX figure out how to properly define components once Famo.us is released
4+
//in the meantime use our hacked together loaded function
5+
Famous.loaded = function (func) {
6+
onLoad.push(func);
7+
};
8+
9+
Famous(function (require) {
10+
_.each(onLoad, function (func) {
11+
func(require);
12+
});
13+
});

packages/famous/package.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Package.describe({
2+
summary: 'A wrapper for the famous library, exposing the various modules.'
3+
});
4+
5+
Package.on_use(function (api) {
6+
api.add_files(['famous.lib.js', 'famous_wrapper.js', 'famous.css'], 'client');
7+
});

packages/paper/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.build*

packages/paper/cover_view.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Famous.loaded(function (require) {
2+
var Surface = require("famous/Surface"),
3+
Modifier = require("famous/Modifier"),
4+
Matrix = require("famous/Matrix"),
5+
View = require("famous/View");
6+
7+
var CoverView = function () {
8+
View.apply(this, arguments), this.profileImg = new Image, this.profileImg.src = this.options.img, this.profileImg.width = 320, this.profileImg.style.webkitBoxReflect = "below";
9+
var coverBackground = new Surface({
10+
content: '<img width="320" src="covers/bg.png" />'
11+
});
12+
13+
var coverBackgroundTransform = new Modifier({
14+
transform: Matrix.translate(0, 0, .001)
15+
});
16+
this._add(coverBackgroundTransform).link(coverBackground);
17+
18+
var profileImageSurface = new Surface({
19+
size: [this.options.size, this.options.size],
20+
content: this.profileImg
21+
});
22+
this._add(profileImageSurface);
23+
};
24+
25+
CoverView.prototype = Object.create(View.prototype);
26+
CoverView.prototype.constructor = CoverView;
27+
CoverView.DEFAULT_OPTIONS = {
28+
text: null,
29+
name: null,
30+
img: null
31+
};
32+
33+
Paper.CoverView = CoverView;
34+
});

0 commit comments

Comments
 (0)