Created
May 17, 2014 03:22
-
-
Save john45traver/cfae8ee43d8aa9a94f0a to your computer and use it in GitHub Desktop.
Scrollview from Bottom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Engine = require("famous/core/Engine"); | |
var Surface = require("famous/core/Surface"); | |
var Scrollview = require("famous/views/Scrollview"); | |
var Transform = require("famous/core/Transform"); | |
var ContainerSurface = require('famous/surfaces/ContainerSurface'); | |
var mainContext = Engine.createContext(); | |
var scrollview = new Scrollview({ | |
margin:100000 | |
}); | |
scrollview.state = new StateModifier({ | |
size:[400,400], | |
origin: [0,1], | |
transform: Transform.translate(0,200,0) | |
}); | |
var surfaces = []; | |
scrollview.sequenceFrom(surfaces); | |
for (var i = 0; i < 5; i++) { | |
if (i != 0 && i != 4) { | |
temp = new Surface({ | |
content: "Surface: " + (i + 1), | |
size: [undefined, 200], | |
properties: { | |
backgroundColor: "hsl(" + (i * 360 / 40) + ", 100%, 50%)", | |
lineHeight: "200px", | |
textAlign: "center" | |
} | |
}); | |
} else { | |
temp = new Surface({ | |
size: [undefined, 200], | |
content:"<div></div>", | |
properties: { | |
backgroundColor: "transparent", | |
lineHeight: "200px", | |
textAlign: "center" | |
} | |
}); | |
} | |
temp.pipe(scrollview); | |
surfaces.push(temp); | |
} | |
mainContext.add(scrollview.state).add(scrollview); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment