Skip to content

Instantly share code, notes, and snippets.

@kmagiera
Created October 24, 2018 16:13
Show Gist options
  • Save kmagiera/c3d5c8350bdade4169d307f8a2d03267 to your computer and use it in GitHub Desktop.
Save kmagiera/c3d5c8350bdade4169d307f8a2d03267 to your computer and use it in GitHub Desktop.
function interaction() {
let dragging = 0;
let start = 0;
let position = 0;
return (gestureTranslation, gestureState) => {
if (gestureState === State.ACTIVE) {
if (dragging === 0) {
dragging = 1;
start = position;
}
position = start + gestureTranslation;
} else {
dragging = 0;
}
return position;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment