Skip to content

Commit 267aa32

Browse files
manucorporatadamdbradley
authored andcommitted
perf(animation): using will-change when using progressStep()
1 parent 4e88f89 commit 267aa32

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/animations/animation.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,16 +618,21 @@ export class Animation {
618618
}
619619

620620
if (Object.keys(this._fx).length) {
621+
easing = (forcedLinearEasing ? 'linear' : this.getEasing());
621622
for (i = 0; i < this._el.length; i++) {
622-
// all parent/child animations should have the same duration
623-
// ******** DOM WRITE ****************
624-
this._el[i].style[CSS.transitionDuration] = duration + 'ms';
625-
626-
// each animation can have a different easing
627-
easing = (forcedLinearEasing ? 'linear' : this.getEasing());
628-
if (easing) {
623+
if (duration > 0) {
624+
// all parent/child animations should have the same duration
629625
// ******** DOM WRITE ****************
630-
this._el[i].style[CSS.transitionTimingFn] = easing;
626+
this._el[i].style[CSS.transition] = '';
627+
this._el[i].style[CSS.transitionDuration] = duration + 'ms';
628+
629+
// each animation can have a different easing
630+
if (easing) {
631+
// ******** DOM WRITE ****************
632+
this._el[i].style[CSS.transitionTimingFn] = easing;
633+
}
634+
} else {
635+
this._el[i].style[CSS.transition] = 'none';
631636
}
632637
}
633638
}
@@ -824,6 +829,9 @@ export class Animation {
824829
this._c[i].progressStart();
825830
}
826831

832+
// ******** DOM WRITE ****************
833+
this._willChg(true);
834+
827835
// ******** DOM WRITE ****************
828836
this._before();
829837

0 commit comments

Comments
 (0)