Skip to content

Instantly share code, notes, and snippets.

@IanLunn
Created January 29, 2013 18:41
Show Gist options
  • Save IanLunn/4666512 to your computer and use it in GitHub Desktop.
Save IanLunn/4666512 to your computer and use it in GitHub Desktop.
Reverse a two-point cubic bezier
/* 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));
@ialexryan
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment