Re: [csswg-drafts] [css-animations] Add control of colorspace used for animating colors (#7062)

> > Is there a need to interpolate in a different colorspace per transition/animation?
> 
> Yes. For maximal Web compat, existing animations need to continue to animate in gamma-encodes sRGB space; yet animations using other, wider gamut color spaces would be severely hampered by being forced to do so.

I don't quite follow the Web compat angle. I assumed this property was acting as an opt-in to use a different colorspace for interpolation for the element(s) it is applied to?

Then again, I think my question was poor. I'm curious if, for a given element, there is a need to apply a different colorspace for different animations/transitions.

> Also, stylesheet authors may choose to use different colorspaces on different animations or transitions depending on the effect they want to achieve.

I can see that would give more flexibility, I'm just wondering if in practice it's needed since it might be simpler if it's not (that is, if authors only ever need to specify one interpolation colorspace per element). But perhaps the Web compat aspect makes this point moot.

> > I'm afraid this still hits the issue where we can't easily add new keywords to the animation shorthand as discussed in #6946.
> 
> So, this means that authors would need to use the animation shorthand to set most of the animation, then a longhand to set the animation colorspace?

Yes, either that or we find a way to somehow add keywords to the `animation` shorthand. We face this same issue with the `animation-composition` property and if we ever introduce new easing keywords we will face it there too so it would be nice to find a general solution to this problem.

> > If it's the former, then this will need to be defined at the Web Animations level and mapped to corresponding properties in CSS animations/transitions.
> 
> Could you unpack that a bit more for me, so I have a clearer idea of what to do next?

I think we'll need to determine first:

* Do we want to allow the author to vary the interpolation colorspace between keyframes like `animation-timing-function` allows? (i.e. use one colorspace between keyframes A and B, but use another between B and C?)
* Or is it enough for the interpolation colorspace to apply across all keyframes in the animation?

If it's the former, we'll want to add a special property like we already have for `offset`, `easing`, and `composite` (e.g. in [this procedure](https://drafts.csswg.org/web-animations-1/#process-a-keyframes-argument)).

If it's the latter, then I imagine we'll extend the definition of [keyframe effects](https://drafts.csswg.org/web-animations-1/#keyframe-effects), perhaps with a section on "interpolation parameters" or the like defining an "interpolation colorspace" parameter or such in the model along with its default value. Then we'd add a suitable IDL member to [`KeyframeEffect`](https://drafts.csswg.org/web-animations-1/#the-keyframeeffect-interface) and [`KeyframeEffectOptions`](https://drafts.csswg.org/web-animations-1/#dictdef-keyframeeffectoptions) similar to `composite` and define how it is applied by the `KeyframeEffect` constructor.

In either case, then we'd finally need to indicate the mapping between the CSS property and the Web Animations model concept in CSS Animations 2 / CSS Transitions 2 (e.g. the [mapping for animation-duration](https://drafts.csswg.org/css-animations-2/#animation-duration)).

For the former case where we allow different colorspaces per interpolation interval, we'd also need to add some prose explaining how to build up the keyframes for a CSS animation in [this section](https://drafts.csswg.org/css-animations-2/#keyframes).

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


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

Received on Friday, 18 February 2022 01:26:34 UTC