From dd5f3c463fab336d694f426dcad11a1783590fc9 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 5 Feb 2022 07:52:13 +0100 Subject: Ported from import syntax to modules --- src/_easing.scss | 172 +++++++++++++++++++++++++++---------------------------- 1 file changed, 86 insertions(+), 86 deletions(-) (limited to 'src/_easing.scss') diff --git a/src/_easing.scss b/src/_easing.scss index a39f317..8b06632 100644 --- a/src/_easing.scss +++ b/src/_easing.scss @@ -14,32 +14,32 @@ /// /// @access private /// -$iro-cubic-bezier-sample-pool: (); +$cubic-bezier-sample-pool: (); /// /// Sample pool size for cubic bezier calculations. /// -$iro-cubic-bezier-sample-pool-size: 10 !default; +$cubic-bezier-sample-pool-size: 10 !default; /// /// Minimum slope required to use the Newton-Raphson method for cubic bezier calculations. /// -$iro-cubic-bezier-newton-min-slope: 0.001 !default; +$cubic-bezier-newton-min-slope: 0.001 !default; /// /// Number of iterations of the Newton-Raphson method. /// -$iro-cubic-bezier-newton-iters: 4 !default; +$cubic-bezier-newton-iters: 4 !default; /// /// Precision of the subdivision method for cubic bezier calculations. /// -$iro-cubic-bezier-subdiv-precision: 0.0000001 !default; +$cubic-bezier-subdiv-precision: 0.0000001 !default; /// /// Maximum iterations of the subdivision method for cubic bezier calculations. /// -$iro-cubic-bezier-subdiv-max-iters: 10 !default; +$cubic-bezier-subdiv-max-iters: 10 !default; /// /// A cubic bezier function identical to the CSS cubic-bezier function. @@ -52,7 +52,7 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-cubic-bezier($x1, $y1, $x2, $y2, $x) { +@function cubic-bezier($x1, $y1, $x2, $y2, $x) { // // Cover simple cases // @@ -73,41 +73,41 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; $sample-pool-key: $x1 + '_' + $x2; - @if not map-has-key($iro-cubic-bezier-sample-pool, $sample-pool-key) { + @if not map-has-key($cubic-bezier-sample-pool, $sample-pool-key) { $samples: (); - @for $i from 0 through $iro-cubic-bezier-sample-pool-size { - $samples: append($samples, iro-cubic-bezier-func($x1, $x2, math.div($i, $iro-cubic-bezier-sample-pool-size))); + @for $i from 0 through $cubic-bezier-sample-pool-size { + $samples: append($samples, cubic-bezier-func($x1, $x2, math.div($i, $cubic-bezier-sample-pool-size))); } - $iro-cubic-bezier-sample-pool: map-merge($iro-cubic-bezier-sample-pool, ($sample-pool-key: $samples)) !global; + $cubic-bezier-sample-pool: map-merge($cubic-bezier-sample-pool, ($sample-pool-key: $samples)) !global; } // // Calculate cubic bezier // - @return iro-cubic-bezier-func($y1, $y2, iro-cubic-bezier-t-for-x($x1, $x2, $x)); + @return cubic-bezier-func($y1, $y2, cubic-bezier-t-for-x($x1, $x2, $x)); } /// /// @access private /// -@function iro-cubic-bezier-func-a($p1, $p2) { +@function cubic-bezier-func-a($p1, $p2) { @return 1 - 3 * $p2 + 3 * $p1; } /// /// @access private /// -@function iro-cubic-bezier-func-b($p1, $p2) { +@function cubic-bezier-func-b($p1, $p2) { @return 3 * $p2 - 6 * $p1; } /// /// @access private /// -@function iro-cubic-bezier-func-c($p1) { +@function cubic-bezier-func-c($p1) { @return 3 * $p1; } @@ -116,8 +116,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @access private /// -@function iro-cubic-bezier-func($p1, $p2, $t) { - @return ((iro-cubic-bezier-func-a($p1, $p2) * $t + iro-cubic-bezier-func-b($p1, $p2)) * $t + iro-cubic-bezier-func-c($p1)) * $t; +@function cubic-bezier-func($p1, $p2, $t) { + @return ((cubic-bezier-func-a($p1, $p2) * $t + cubic-bezier-func-b($p1, $p2)) * $t + cubic-bezier-func-c($p1)) * $t; } /// @@ -125,8 +125,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @access private /// -@function iro-cubic-bezier-func-slope($p1, $p2, $t) { - @return 3 * iro-cubic-bezier-func-a($p1, $p2) * $t * $t + 2 * iro-cubic-bezier-func-b($p1, $p2) * $t + iro-cubic-bezier-func-c($p1); +@function cubic-bezier-func-slope($p1, $p2, $t) { + @return 3 * cubic-bezier-func-a($p1, $p2) * $t * $t + 2 * cubic-bezier-func-b($p1, $p2) * $t + cubic-bezier-func-c($p1); } /// @@ -134,15 +134,15 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @access private /// -@function iro-cubic-bezier-newton-raphson($x1, $x2, $x, $t) { - @for $i from 1 through $iro-cubic-bezier-newton-iters { - $cur-slope: iro-cubic-bezier-func-slope($x1, $x2, $t); +@function cubic-bezier-newton-raphson($x1, $x2, $x, $t) { + @for $i from 1 through $cubic-bezier-newton-iters { + $cur-slope: cubic-bezier-func-slope($x1, $x2, $t); @if $cur-slope == 0 { @return $t; } - $cur-x: iro-cubic-bezier-func($x1, $x2, $t) - $x; + $cur-x: cubic-bezier-func($x1, $x2, $t) - $x; $t: $t - math.div($cur-x, $cur-slope); } @@ -154,14 +154,14 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @access private /// -@function iro-cubic-bezier-binary-subdivide($x1, $x2, $x, $a, $b) { +@function cubic-bezier-binary-subdivide($x1, $x2, $x, $a, $b) { $cur-x: 0; $cur-t: 0; $i: 0; - @while $i < $iro-cubic-bezier-subdiv-max-iters { + @while $i < $cubic-bezier-subdiv-max-iters { $cur-t: $a + ($b - $a) / 2; - $cur-x: iro-cubic-bezier-func($x1, $x2, $cur-t) - $x; + $cur-x: cubic-bezier-func($x1, $x2, $cur-t) - $x; @if $cur-x > 0 { $b: $cur-t; @@ -169,7 +169,7 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; $a: $cur-t; } - @if abs($cur-x) < $iro-cubic-bezier-subdiv-precision { + @if abs($cur-x) < $cubic-bezier-subdiv-precision { @return $cur-t; } } @@ -182,30 +182,30 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @access private /// -@function iro-cubic-bezier-t-for-x($x1, $x2, $x) { +@function cubic-bezier-t-for-x($x1, $x2, $x) { $sample-pool-key: $x1 + '_' + $x2; - $samples: map-get($iro-cubic-bezier-sample-pool, $sample-pool-key); + $samples: map-get($cubic-bezier-sample-pool, $sample-pool-key); $intv-start: 0; $cur-sample: 1; - $last-sample: $iro-cubic-bezier-sample-pool-size; + $last-sample: $cubic-bezier-sample-pool-size; @while ($cur-sample != $last-sample) and (nth($samples, $cur-sample) <= $x) { - $intv-start: $intv-start + math.div(1, $iro-cubic-bezier-sample-pool-size); + $intv-start: $intv-start + math.div(1, $cubic-bezier-sample-pool-size); $cur-sample: $cur-sample + 1; } $cur-sample: $cur-sample - 1; $dist: math.div($x - nth($samples, $cur-sample), nth($samples, $cur-sample + 1) - nth($samples, $cur-sample)); - $guess-t: $intv-start + math.div($dist, $iro-cubic-bezier-sample-pool-size); + $guess-t: $intv-start + math.div($dist, $cubic-bezier-sample-pool-size); - $init-slope: iro-cubic-bezier-func-slope($x1, $x2, $guess-t); - @if $init-slope >= $iro-cubic-bezier-newton-min-slope { - @return iro-cubic-bezier-newton-raphson($x1, $x2, $x, $guess-t); + $init-slope: cubic-bezier-func-slope($x1, $x2, $guess-t); + @if $init-slope >= $cubic-bezier-newton-min-slope { + @return cubic-bezier-newton-raphson($x1, $x2, $x, $guess-t); } @else if $init-slope == 0 { @return $guess-t; } @else { - @return iro-cubic-bezier-binary-subdivide($x1, $x2, $x, $intv-start, $intv-start + 1 / $iro-cubic-bezier-sample-pool-size); + @return cubic-bezier-binary-subdivide($x1, $x2, $x, $intv-start, $intv-start + 1 / $cubic-bezier-sample-pool-size); } } @@ -216,8 +216,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease($x) { - @return iro-cubic-bezier(0.25, 0.1, 0.25, 1, $x); +@function ease($x) { + @return cubic-bezier(0.25, 0.1, 0.25, 1, $x); } /// @@ -227,8 +227,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in($x) { - @return iro-cubic-bezier(0.42, 0, 1, 1, $x); +@function ease-in($x) { + @return cubic-bezier(0.42, 0, 1, 1, $x); } /// @@ -238,8 +238,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out($x) { - @return iro-cubic-bezier(0, 0, 0.58, 1, $x); +@function ease-out($x) { + @return cubic-bezier(0, 0, 0.58, 1, $x); } /// @@ -249,8 +249,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out($x) { - @return iro-cubic-bezier(0.42, 0, 0.58, 1, $x); +@function ease-in-out($x) { + @return cubic-bezier(0.42, 0, 0.58, 1, $x); } /// @@ -260,8 +260,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-sine($x) { - @return iro-cubic-bezier(0.47, 0, 0.745, 0.715, $x); +@function ease-in-sine($x) { + @return cubic-bezier(0.47, 0, 0.745, 0.715, $x); } /// @@ -271,8 +271,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-sine($x) { - @return iro-cubic-bezier(0.39, 0.575, 0.565, 1, $x); +@function ease-out-sine($x) { + @return cubic-bezier(0.39, 0.575, 0.565, 1, $x); } /// @@ -282,8 +282,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-sine($x) { - @return iro-cubic-bezier(0.445, 0.05, 0.55, 0.95, $x); +@function ease-in-out-sine($x) { + @return cubic-bezier(0.445, 0.05, 0.55, 0.95, $x); } /// @@ -293,8 +293,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-quad($x) { - @return iro-cubic-bezier(0.55, 0.085, 0.68, 0.53, $x); +@function ease-in-quad($x) { + @return cubic-bezier(0.55, 0.085, 0.68, 0.53, $x); } /// @@ -304,8 +304,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-quad($x) { - @return iro-cubic-bezier(0.25, 0.46, 0.45, 0.94, $x); +@function ease-out-quad($x) { + @return cubic-bezier(0.25, 0.46, 0.45, 0.94, $x); } /// @@ -315,8 +315,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-quad($x) { - @return iro-cubic-bezier(0.455, 0.03, 0.515, 0.955, $x); +@function ease-in-out-quad($x) { + @return cubic-bezier(0.455, 0.03, 0.515, 0.955, $x); } /// @@ -326,8 +326,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-cubic($x) { - @return iro-cubic-bezier(0.55, 0.055, 0.675, 0.19, $x); +@function ease-in-cubic($x) { + @return cubic-bezier(0.55, 0.055, 0.675, 0.19, $x); } /// @@ -337,8 +337,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-cubic($x) { - @return iro-cubic-bezier(0.215, 0.61, 0.355, 1, $x); +@function ease-out-cubic($x) { + @return cubic-bezier(0.215, 0.61, 0.355, 1, $x); } /// @@ -348,8 +348,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-cubic($x) { - @return iro-cubic-bezier(0.645, 0.045, 0.355, 1, $x); +@function ease-in-out-cubic($x) { + @return cubic-bezier(0.645, 0.045, 0.355, 1, $x); } /// @@ -359,8 +359,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-quart($x) { - @return iro-cubic-bezier(0.895, 0.03, 0.685, 0.22, $x); +@function ease-in-quart($x) { + @return cubic-bezier(0.895, 0.03, 0.685, 0.22, $x); } /// @@ -370,8 +370,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-quart($x) { - @return iro-cubic-bezier(0.165, 0.84, 0.44, 1, $x); +@function ease-out-quart($x) { + @return cubic-bezier(0.165, 0.84, 0.44, 1, $x); } /// @@ -381,8 +381,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-quart($x) { - @return iro-cubic-bezier(0.77, 0, 0.175, 1, $x); +@function ease-in-out-quart($x) { + @return cubic-bezier(0.77, 0, 0.175, 1, $x); } /// @@ -392,8 +392,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-quint($x) { - @return iro-cubic-bezier(0.755, 0.05, 0.855, 0.06, $x); +@function ease-in-quint($x) { + @return cubic-bezier(0.755, 0.05, 0.855, 0.06, $x); } /// @@ -403,8 +403,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-quint($x) { - @return iro-cubic-bezier(0.23, 1, 0.32, 1, $x); +@function ease-out-quint($x) { + @return cubic-bezier(0.23, 1, 0.32, 1, $x); } /// @@ -414,8 +414,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-quint($x) { - @return iro-cubic-bezier(0.86, 0, 0.07, 1, $x); +@function ease-in-out-quint($x) { + @return cubic-bezier(0.86, 0, 0.07, 1, $x); } /// @@ -425,8 +425,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-expo($x) { - @return iro-cubic-bezier(0.95, 0.05, 0.795, 0.035, $x); +@function ease-in-expo($x) { + @return cubic-bezier(0.95, 0.05, 0.795, 0.035, $x); } /// @@ -436,8 +436,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-expo($x) { - @return iro-cubic-bezier(0.19, 1, 0.22, 1, $x); +@function ease-out-expo($x) { + @return cubic-bezier(0.19, 1, 0.22, 1, $x); } /// @@ -447,8 +447,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-expo($x) { - @return iro-cubic-bezier(1, 0, 0, 1, $x); +@function ease-in-out-expo($x) { + @return cubic-bezier(1, 0, 0, 1, $x); } /// @@ -458,8 +458,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-circ($x) { - @return iro-cubic-bezier(0.6, 0.04, 0.98, 0.335, $x); +@function ease-in-circ($x) { + @return cubic-bezier(0.6, 0.04, 0.98, 0.335, $x); } /// @@ -469,8 +469,8 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-out-circ($x) { - @return iro-cubic-bezier(0.075, 0.82, 0.165, 1, $x); +@function ease-out-circ($x) { + @return cubic-bezier(0.075, 0.82, 0.165, 1, $x); } /// @@ -480,6 +480,6 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default; /// /// @return {number} /// -@function iro-ease-in-out-circ($x) { - @return iro-cubic-bezier(0.785, 0.135, 0.15, 0.86, $x); +@function ease-in-out-circ($x) { + @return cubic-bezier(0.785, 0.135, 0.15, 0.86, $x); } -- cgit v1.3.1