Created
July 21, 2014 20:11
-
-
Save xcoderzach/26cf445e055fbd490e5b to your computer and use it in GitHub Desktop.
simulated scrolling that bounces once it reaches the edge, and damps if you pull it outside the boundry.
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 boundry = Physics.Boundry(0, 0, height, width) | |
var draggable = drag({ boundryDamping: .2 }).bounds(boundry) | |
var decelerate = phys.decelerate({ deceleration: 1000 }).bounds(boundry).start | |
var spring = phys.spring({ deceleration: 1000 }).start | |
draggable.pipe(phys) | |
draggable.start() | |
.then(decelerate) | |
.then(spring) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment