Last active
October 25, 2018 10:05
-
-
Save kmagiera/93e5f3123a605acca4dd2e56b5aeab98 to your computer and use it in GitHub Desktop.
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
function interaction(gestureTranslation, gestureState) { | |
const start = new Value(0); | |
const dragging = new Value(0); | |
const position = new Value(0); | |
return cond( | |
eq(gestureState, State.ACTIVE), | |
[ | |
cond(eq(dragging, 0), [set(dragging, 1), set(start, position)]), | |
set(position, add(start, gestureTranslation)), | |
], | |
[set(dragging, 0), position] | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment