Created
July 18, 2017 21:39
-
-
Save psql/d9e0d773beafae2da3681ddcab36a9fc to your computer and use it in GitHub Desktop.
Accumulative Delta
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
gesture = new Layer | |
height: Screen.height | |
width: Screen.width | |
resetX = 400 | |
jiggler = new Layer | |
x: resetX | |
y: 527 | |
height: 128 | |
jigglerClamped = new Layer | |
x: resetX | |
y: 842 | |
height: 128 | |
gesture.onPan (event)-> | |
offset = jiggler.x + event.delta.x | |
jiggler.x = offset | |
jigglerClamped.x = | |
jigglerClamped.x + Utils.modulate(event.delta.x,[-Screen.width,Screen.width],[-200,200],true) | |
# Reset | |
gesture.onPanEnd -> | |
jiggler.animate | |
properties: | |
x: resetX | |
time: 0.2 | |
jigglerClamped.animate | |
properties: | |
x: resetX | |
time: 0.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment