Skip to content

Instantly share code, notes, and snippets.

@pketh
Created June 21, 2019 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pketh/c77e4f056374e13705bd07ad05f24ba0 to your computer and use it in GitHub Desktop.
Save pketh/c77e4f056374e13705bd07ad05f24ba0 to your computer and use it in GitHub Desktop.
easings js
easing (percentComplete, elaspedTime) {
const duration = lockingDuration
const startValue = 0
const endValue = 1
// https://stackoverflow.com/questions/8316882/what-is-an-easing-function
// x percentComplete,
// t elaspedTime,
// b startValue,
// c endValue,
// d duration
// quadratic ease in
// return endValue * (elaspedTime/=duration)*elaspedTime + startValue
// ease out
return -endValue * (elaspedTime /= duration) * (elaspedTime - 2) + startValue
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment