Skip to content

Instantly share code, notes, and snippets.

@sylistine
Last active April 14, 2016 19:36
Show Gist options
  • Save sylistine/80b9db7c0b4edcd27c7560cb342b7e63 to your computer and use it in GitHub Desktop.
Save sylistine/80b9db7c0b4edcd27c7560cb342b7e63 to your computer and use it in GitHub Desktop.
// AKA'd as Lerp
// Returns the point between A and B if t is time or progress and is clamped between 0 and 1
function LinearBezier(A, B, t) : float {
return (1-t) * A +
(t) * B;
}
// Querp?
function QuadraticBezier(A, B, C, t) : float {
return (1-t) * LinearBezier(A, B, t) +
(t) * LinearBezier(B, C, t);
}
// Curp.
function CubicBezier(A, B, C, D, t) : float {
return (1-t) * QuadraticBezier(A, B, C, t) +
(1) * QuadraticBezier(B, C, D, t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment