Created
March 11, 2020 13:09
-
-
Save andyshora/2b82bd6d02275bab71d0a2cf5a548b22 to your computer and use it in GitHub Desktop.
This file contains 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
const linearInterpolate = interpolateObject({ val: 0 }, { val: 100 }) | |
console.log(linearInterpolate(0.25)) | |
console.log(linearInterpolate(0.75)) | |
const easeInterpolate = easeFn => (a, b) => { | |
const i = interpolateObject(a, b) | |
return t => i(easeFn(t)) | |
} | |
const curvedInterpolate = easeInterpolate(easeQuadInOut)({ val: 0 }, { val: 100 }) | |
console.log(curvedInterpolate(0.25)) | |
console.log(curvedInterpolate(0.75)) | |
// one liner: | |
// const easeInterpolate = easeFn => (a, b) => t => interpolateObject(a, b)(easeFn(t)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment