Created
October 24, 2018 16:13
-
-
Save kmagiera/c3d5c8350bdade4169d307f8a2d03267 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() { | |
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