Skip to content

[web-animations-1] Should calling reverse() set effect.timing.direction to "reverse"? #2543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
guest271314 opened this issue Apr 11, 2018 · 5 comments

Comments

@guest271314
Copy link

  • please tag the issue title with the spec's shortname, like [css-foo]
  • please link to the spec section you're talking about, or at least the spec

https://drafts.csswg.org/web-animations/#directed-progress; https://drafts.csswg.org/web-animations/#dom-animation-reverse

At Chromium 65, calling reverse() does not appear to change the value of effect.timing.direction.

The specification does not explicitly state that effect.timing.direction is changed based on the current or previous direction of the animation.

Should calling reverse() set effect.timing.direction to "reverse"?

How to determine the current or previous (is paused) direction of an animation?

.

@birtles
Copy link
Contributor

birtles commented Apr 12, 2018

Thank you for filing this issue. reverse() is defined to update the playback rate of an Animation. It is unrelated to the playback direction of an effect.

So, to answer your question, reverse() should not change effect.timing.direction.

You can determine if an animation is being played backwards by looking at Animation.playbackRate.

I'm closing this issue for now but please let me know if this does not satisfy your concern.

@birtles birtles closed this as completed Apr 12, 2018
@guest271314
Copy link
Author

Your clarification is helpful. Has adding a specific property to the Animation instance as to whether the animation is being played forwards or backwards been considered?

@birtles
Copy link
Contributor

birtles commented Apr 12, 2018

I'm afraid it hasn't. It's usually as simple as const isPlayingBackwards = anim.playbackRate < 0.

@guest271314
Copy link
Author

Would anim refer to the same object? This achieves the expected result

animation.playbackRate > 0 ? "forwards" : "reverse"

though, of course, animation.timing.effect.direction is still "normal". Was just surprising that there does not exist a property to get the current direction of the animation. If playback rate is unrelated to playbac direction, can the differences be clearly distinguished?

@birtles
Copy link
Contributor

birtles commented Apr 12, 2018

The playback direction is a static timing property of an effect. It describes from which way the keyframes are iterated over, including alternating backwards and forwards.

The playback rate is a runtime property of an animation used to change how the linked effect is viewed at the current time.

As an analogy the playback direction is a property of a DVD that describes whether the credits scroll up or down, while the playback rate is a property of the DVD player that describes whether you are fast-forwarding, rewinding, or playing at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants