File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ interface GradientParams {
1717type ColorInterpolateFunction = ( input : number ) => string
1818
1919const easeInOut = Easing . bezier ( 0.42 , 0 , 0.58 , 1 )
20- const TOTAL_STOPS_PER_STEP = 16
20+ const TOTAL_STOPS_PER_TRANSITION = 16
2121
2222function easeGradient ( { colorStops, easing = easeInOut } : GradientParams ) {
2323 const colors : string [ ] = [ ]
@@ -51,18 +51,18 @@ function easeGradient({ colorStops, easing = easeInOut }: GradientParams) {
5151 interpolationConfig
5252 )
5353
54- const stepSize = endLocation - startLocation
55- const frameSize = 1 / ( TOTAL_STOPS_PER_STEP - 1 )
54+ const currentTransitionLength = endLocation - startLocation
55+ const stepSize = 1 / ( TOTAL_STOPS_PER_TRANSITION - 1 )
5656
5757 for (
58- let frameIndex = 0 ;
59- frameIndex <= TOTAL_STOPS_PER_STEP - 1 ;
60- frameIndex ++
58+ let stepIndex = 0 ;
59+ stepIndex <= TOTAL_STOPS_PER_TRANSITION - 1 ;
60+ stepIndex ++
6161 ) {
62- const progress = frameIndex * frameSize
62+ const progress = stepIndex * stepSize
6363 const color = colorScale ( progress )
6464 colors . push ( color )
65- locations . push ( startLocation + stepSize * progress )
65+ locations . push ( startLocation + currentTransitionLength * progress )
6666 }
6767 }
6868
You can’t perform that action at this time.
0 commit comments