aboutsummaryrefslogtreecommitdiffstats
path: root/src/_easing.scss
diff options
context:
space:
mode:
Diffstat (limited to 'src/_easing.scss')
-rw-r--r--src/_easing.scss12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/_easing.scss b/src/_easing.scss
index c41635b..a39f317 100644
--- a/src/_easing.scss
+++ b/src/_easing.scss
@@ -9,6 +9,8 @@
9/// @access public 9/// @access public
10//// 10////
11 11
12@use 'sass:math';
13
12/// 14///
13/// @access private 15/// @access private
14/// 16///
@@ -75,7 +77,7 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default;
75 $samples: (); 77 $samples: ();
76 78
77 @for $i from 0 through $iro-cubic-bezier-sample-pool-size { 79 @for $i from 0 through $iro-cubic-bezier-sample-pool-size {
78 $samples: append($samples, iro-cubic-bezier-func($x1, $x2, $i / $iro-cubic-bezier-sample-pool-size)); 80 $samples: append($samples, iro-cubic-bezier-func($x1, $x2, math.div($i, $iro-cubic-bezier-sample-pool-size)));
79 } 81 }
80 82
81 $iro-cubic-bezier-sample-pool: map-merge($iro-cubic-bezier-sample-pool, ($sample-pool-key: $samples)) !global; 83 $iro-cubic-bezier-sample-pool: map-merge($iro-cubic-bezier-sample-pool, ($sample-pool-key: $samples)) !global;
@@ -141,7 +143,7 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default;
141 } 143 }
142 144
143 $cur-x: iro-cubic-bezier-func($x1, $x2, $t) - $x; 145 $cur-x: iro-cubic-bezier-func($x1, $x2, $t) - $x;
144 $t: $t - $cur-x / $cur-slope; 146 $t: $t - math.div($cur-x, $cur-slope);
145 } 147 }
146 148
147 @return $t; 149 @return $t;
@@ -189,13 +191,13 @@ $iro-cubic-bezier-subdiv-max-iters: 10 !default;
189 $last-sample: $iro-cubic-bezier-sample-pool-size; 191 $last-sample: $iro-cubic-bezier-sample-pool-size;
190 192
191 @while ($cur-sample != $last-sample) and (nth($samples, $cur-sample) <= $x) { 193 @while ($cur-sample != $last-sample) and (nth($samples, $cur-sample) <= $x) {
192 $intv-start: $intv-start + (1 / $iro-cubic-bezier-sample-pool-size); 194 $intv-start: $intv-start + math.div(1, $iro-cubic-bezier-sample-pool-size);
193 $cur-sample: $cur-sample + 1; 195 $cur-sample: $cur-sample + 1;
194 } 196 }
195 $cur-sample: $cur-sample - 1; 197 $cur-sample: $cur-sample - 1;
196 198
197 $dist: ($x - nth($samples, $cur-sample)) / (nth($samples, $cur-sample + 1) - nth($samples, $cur-sample)); 199 $dist: math.div($x - nth($samples, $cur-sample), nth($samples, $cur-sample + 1) - nth($samples, $cur-sample));
198 $guess-t: $intv-start + $dist / $iro-cubic-bezier-sample-pool-size; 200 $guess-t: $intv-start + math.div($dist, $iro-cubic-bezier-sample-pool-size);
199 201
200 $init-slope: iro-cubic-bezier-func-slope($x1, $x2, $guess-t); 202 $init-slope: iro-cubic-bezier-func-slope($x1, $x2, $guess-t);
201 @if $init-slope >= $iro-cubic-bezier-newton-min-slope { 203 @if $init-slope >= $iro-cubic-bezier-newton-min-slope {