[animation-triggers-1] Should play-forwards and play-backwards have no effect if the animation has already reached its end?
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
Currently, the table in animation-triggers-1 says the following above play-forwards and play-backwards:
| Keyword | Extra Effect | initial | playing | paused | finished |
|---|---|---|---|---|---|
| play-forwards | set playback rate to positive | play() | — | play() | play() |
| play-backwards | set playback rate to negative | play() | — | play() | play() |
The reason we wanted to have play-forwards and play-backwards was to support reversing effects, however, if according to the table we call play() when the effect is finished it sounds like we would restart the animation even if it has already reached its end. I think this is not at all what developers would expect.
E.g. suppose a developer sets up an animation on a button:
@keyframes press-animation {
to: { transform: translate2d(-5px, 5px); }
}
button {
animation: press-animation forwards;
event-trigger: --press pointerdown, --depress pointerup;
animation-trigger: --press play-forward --depress play-backward;
}
The intention is clearly that the button should animate to its pressed state, and back, however it may be possible to trigger the pointerup action multiple times (e.g. clicking both buttons one at a time and releasing one at a time). If the user does this, I think the developer would not intend the animation to replay the press animation from the start but rather to just stay pressed.
TLDR; I think we should not play the animation if it is finished after setting the playback rate for play-forwards and play-backwards
@ydaniv @DavMila
Note: I think it is not easy to create this degenerate situation with timeline triggers because we don't support multiple triggers yet and stateful triggers won't retrigger the exit state if they didn't first enter the entry state.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the animation-triggers-1 shorthand table linked in the issue and review the 13-comment discussion about play-forwards and play-backwards in the finished state. Determine the intended behavior for already-finished animations, then update the specification wording and table once the semantics are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100