Skip to content

Instantly share code, notes, and snippets.

@xiel
Created January 3, 2020 19:06
Show Gist options
  • Save xiel/df18062103bcde712547ee07d179ae0a to your computer and use it in GitHub Desktop.
Save xiel/df18062103bcde712547ee07d179ae0a to your computer and use it in GitHub Desktop.
projection function, returning distance that is to be expected from a release velocity of a gesture (spring / animation)
const DECAY_FAST = 0.99
const DECAY_NORMAL = 0.998
const projection = (velocityPxMs: number) => (velocityPxMs * DECAY_FAST) / (1 - DECAY_FAST)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment