Skip to content

Commit 17d8a88

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.
1 parent 89c9a4d commit 17d8a88

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)