Re: [csswg-drafts] [web-animations-2][css-animations-2] Set of actions for animation triggers (#12611)

Yes, thanks @DavMila!

Some clarification on the behavior of `auto`:

It allows automatically mirroring the paired exit behaviors to the exit event if one exists. Otherwise, if the behavior is a granular one, it resolves to `none`. So we get the following mapping:

| Enter behavior | `auto` computed exit behavior |
|:---------------|:------------------------|
| `play` | `none` |
| `play-once` | `none` |
| `play-forwards` | `none` |
| `play-backwards` | `none` |
| `pause` | `none` |
| `reset` | `none` |
| `replay` | `none` |

And where it gets interesting:

| Specified enter behavior | `auto` computed enter/exit behaviors |
|:---------------|:------------------------|
| `play-pause` | `play` `pause` |
| `play-alternate` | `play-forwards` `play-backwards` |
| `play-reset` | `play` `reset` |

* Notice I added again the `play-reset` for completeness, if there's no objection.

This allows to be able to consistently set a single trigger (timeline or event) and a single behavior, and they will always work as expected.
For a single enter event these behaviors duplicated to alternate for the same event, as in:

```css
.target {
  event-trigger: --play-state click;
  animation-trigger: --play-state play-pause;
}
```

And for a pair of events, or a timeline trigger it's mapped to the enter/exit events, as in:

```css
.target {
  event-trigger: --play-state click / pointerleave;
  /* or with a timeline trigger */
  timeline-trigger: --play-state view();

  animation-trigger: --play-state play-pause;
}
```

So there's no caveats here (:
And of course, you can always specify an explicit `none`, or use it for the enter behavior if you wish to only target the exit.

-- 
GitHub Notification of comment by ydaniv
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12611#issuecomment-3375710484 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 7 October 2025 08:15:11 UTC