Skip to content

Instantly share code, notes, and snippets.

@kmagiera
Last active October 25, 2018 10:05
Show Gist options
  • Save kmagiera/93e5f3123a605acca4dd2e56b5aeab98 to your computer and use it in GitHub Desktop.
Save kmagiera/93e5f3123a605acca4dd2e56b5aeab98 to your computer and use it in GitHub Desktop.
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