Last active
August 29, 2015 14:05
-
-
Save AdrianRossouw/5d4c2e37e835c419a5ed to your computer and use it in GitHub Desktop.
This file contains 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 Modifier = require("famous/core/Modifier"); | |
var Transform = require("famous/core/Transform"); | |
var Transitionable = require("famous/transitions/Transitionable"); | |
var WallTransition = require("famous/transitions/WallTransition"); | |
// create the main context | |
var mainContext = Engine.createContext(); | |
var surface = new Surface({ | |
size: [100, 100], | |
content: 'Click Me', | |
classes: ['red-bg'], | |
properties: { | |
textAlign: 'center', | |
lineHeight: '100px' | |
} | |
}); | |
var modifier = new Modifier({ | |
origin: [.5, 1], | |
transform: Transform.translate(0, -240, 0) | |
}); | |
Transitionable.registerMethod('wall', WallTransition); | |
var transition = { | |
method: 'wall', | |
period: 600, | |
dampingRatio: 0.5, | |
velocity: 0, | |
restitution: .05 //how bouncy the wall is | |
}; | |
surface.on("click", function () { | |
modifier.setTransform(Transform.translate(0, -480, 0), transition); | |
}); | |
mainContext.add(modifier).add(surface); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment