-
-
Save matthewsimo/37044f03bd48645de7ef02d33e2327f4 to your computer and use it in GitHub Desktop.
Reverse a two-point cubic bezier
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
/* sample cubic beziers */ | |
linear = [0.250, 0.250, 0.750, 0.750]; | |
ease = [0.250, 0.100, 0.250, 1.000]; | |
easeIn = [0.420, 0.000, 1.000, 1.000]; | |
easeOut = [0.000, 0.000, 0.580, 1.000]; | |
easeInOut = [0.420, 0.000, 0.580, 1.000]; | |
function reverseCubicBezier(cubicBezier) { | |
return [ | |
1 - cubicBezier[2], | |
1 - cubicBezier[3], | |
1 - cubicBezier[0], | |
1 - cubicBezier[1] | |
]; | |
} | |
console.log(reverseCubicBezier(linear)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment