- From: Brian Birtles via GitHub <sysbot+gh@w3.org>
- Date: Tue, 25 Jun 2024 05:35:40 +0000
- To: public-css-archive@w3.org
@LeaVerou That's great that we're on the same page about not having to preserve `allow-discrete`. No doubt you can think of many better ideas for ways to avoid that than me!
However, I think there's still a fundamental layering issue with regards to repurposing `transition-behavior`.
Suppose we add `animation-behavior` to CSS Animations and a `behavior` property to the Web Animations API. For now, let's assume that `behavior` is a property of an _animation_ in the general sense (since from an API/implementation point of view CSS transitions and CSS animations are subclasses of `Animation`) and we map `transition-behavior` and `animation-behavior` onto that property.
UAs apply `transition-behavior`'s `allow-discrete` value when they determine which animations (transitions) to generate.
If we have:
```css
div {
text-wrap: wrap;
transition: all 1s;
transition-behavior: allow-discrete;
}
div:hover {
text-wrap: balance;
}
```
Then when the div is hovered, we're going to generate a transition for the `text-wrap-style` property.
Suppose we spec that UAs set the generated `CSSTransition`'s `behavior` property to `"allow-discrete"` in this case. Firstly, this seems redundant (the very existence of the transition _is_ the application of the `transition-behavior: allow-discrete`) but let's ignore that for now.
This property would need to be mutable so authors can change the color interpolation mode but if you change `behavior` to `"normal`" in this case would the `CSSTransition` disappear? That would be surprising and I'm not even sure we have a means for representing an orphaned animation like that. We could make the animation start skipping discrete properties in its keyframes but then we're doing something new that is different to `transition-behavior` (which controls which transitions are _generated_).
However, it gets possibly more awkward when we consider where this property _actually_ lives. Presumably, we want to be able to change the color interpolation space between _pairs_ of values. That is, like `animation-timing-function` and `animation-composition`, you should be able to specify `animation-behavior` on individual keyframes. As a result, it would be possible to write content like:
```css
@keyframes anim {
from {
animation-behavior: allow-discrete;
text-wrap: wrap;
}
50% {
text-wrap: balance;
}
to {
text-wrap: wrap;
}
}
```
With that setup, however, making the transition disappear when `behavior` becomes `"normal"` becomes impossible and we're left doing something that is different from how `transition-behavior: normal` actually behaves.
Perhaps there are good solutions to all these issues but so far my impression is that `transition-behavior` is doing something too different to color interpolation modes to be able to be reused here. I certainly appreciate the desire to re-use it, however. It would be nice if we could—I'm just not (yet) convinced we can.
--
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7063#issuecomment-2188017591 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 25 June 2024 05:35:41 UTC