Skip to content

Commit 5b70d6a

Browse files
committed
Use more descriptive variable names
1 parent a47b374 commit 5b70d6a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface GradientParams {
1717
type ColorInterpolateFunction = (input: number) => string
1818

1919
const easeInOut = Easing.bezier(0.42, 0, 0.58, 1)
20-
const TOTAL_STOPS_PER_STEP = 16
20+
const TOTAL_STOPS_PER_TRANSITION = 16
2121

2222
function 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

0 commit comments

Comments
 (0)