Created
February 7, 2018 21:15
-
-
Save rchipka/081adf66e3b44b97b15cebf2090ba445 to your computer and use it in GitHub Desktop.
SASS cubic bezier function for precalculated CSS easing
This file contains hidden or 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
| @function pow($number, $exponent) { | |
| $value: 1; | |
| @if $exponent > 0 { | |
| @for $i from 1 through $exponent { | |
| $value: $value * $number; | |
| } | |
| } | |
| @return $value; | |
| } | |
| @function cubic-bezier($x, $a, $b, $c, $d) { | |
| @return | |
| ($a * pow(1 - $x, 3)) + | |
| ($b * 3 * pow(1 - $x, 2) * $x) + | |
| ($c * 3 * (1 - $x) * pow($x, 2)) + | |
| ($d * pow($x, 3)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment