Skip to content

Commit 373cc21

Browse files
committed
fix: clamp initial progress value #5
1 parent 3d9063d commit 373cc21

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/classes/Element.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ export class Element {
187187
this._setElementStyles();
188188
} else if (isFirstChange) {
189189
// NOTE: this._updateElementProgress -- dont use this because it will trigger onChange
190-
this.progress = getProgressAmount(start, total, s, this.easing);
190+
this.progress = clamp(
191+
Math.round(getProgressAmount(start, total, s, this.easing)),
192+
0,
193+
1
194+
);
191195
this._setElementStyles();
192196
}
193197

0 commit comments

Comments
 (0)