Skip to content

Commit 6f41efc

Browse files
thePunderWomanmattrbeck
authored andcommitted
refactor(core): Update determineLongestAnimation to account for playback rate
This updates the determineLongestAnimation code to also calculate the playback rate in with the duration, which should also account for timing when testing with playback rates changed in devtools. (cherry picked from commit 17d8a88)
1 parent bfb8b17 commit 6f41efc

2 files changed

Lines changed: 437 additions & 0 deletions

File tree

packages/core/src/animation/longest_animation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ function determineLongestAnimationFromElementAnimations(
131131
const animDuration = typeof timing?.duration === 'number' ? timing.duration : 0;
132132
let duration = (timing?.delay ?? 0) + animDuration;
133133

134+
// Account for playback rate if it is set
135+
const playbackRate = animation.playbackRate;
136+
if (playbackRate !== undefined && playbackRate !== 0 && playbackRate !== 1) {
137+
duration /= Math.abs(playbackRate);
138+
}
139+
134140
let propertyName: string | undefined;
135141
let animationName: string | undefined;
136142

0 commit comments

Comments
 (0)