Skip to content

Commit

Permalink
Realign start time if finite timeline and auto-rewind is true
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland committed Feb 10, 2024
1 parent 1c71677 commit ab6f21a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/proxy-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,13 @@ function playInternal(details, autoRewind) {
}

// Not by spec, but required by tests in play-animation.html:
// – Playing a running animation resets a sticky start time
// - Playing a finished animation restarts the animation aligned at the start
// - Playing a pause-pending but previously finished animation realigns with the scroll position
// - Playing a finished animation clears the start time
if (details.proxy.playState === 'finished' || abortedPause) {
// - Resuming an animation from paused realigns with scroll position.
// These tests suggest that the start time should always be auto aligned when auto-rewind and finite timeline is true
if (autoRewind) {
details.holdTime = null
details.startTime = null
details.autoAlignStartTime = true;
Expand Down
4 changes: 2 additions & 2 deletions test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -829,14 +829,14 @@ FAIL /scroll-animations/scroll-timelines/play-animation.html Playing an animatio
PASS /scroll-animations/scroll-timelines/play-animation.html Playing an animations with a negative playback rate aligns the start time with the end of the active range
PASS /scroll-animations/scroll-timelines/play-animation.html Start time set while play pending is preserved.
PASS /scroll-animations/scroll-timelines/play-animation.html Current time set while play pending is preserved.
FAIL /scroll-animations/scroll-timelines/play-animation.html Playing a running animation resets a sticky start time
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a running animation resets a sticky start time
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a finished animation restarts the animation aligned at the start
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a finished and reversed animation restarts the animation aligned at the end
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a pause-pending but previously finished animation realigns with the scroll position
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a finished animation clears the start time
PASS /scroll-animations/scroll-timelines/play-animation.html The ready promise should be replaced if the animation is not already pending
PASS /scroll-animations/scroll-timelines/play-animation.html A pending ready promise should be resolved and not replaced when the animation enters the running state
FAIL /scroll-animations/scroll-timelines/play-animation.html Resuming an animation from paused realigns with scroll position.
PASS /scroll-animations/scroll-timelines/play-animation.html Resuming an animation from paused realigns with scroll position.
PASS /scroll-animations/scroll-timelines/play-animation.html If a pause operation is interrupted, the ready promise is reused
FAIL /scroll-animations/scroll-timelines/play-animation.html A pending playback rate is used when determining timeline range alignment
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a canceled animation sets the start time
Expand Down

0 comments on commit ab6f21a

Please sign in to comment.