Re: [csswg-drafts] [css-values-4] Abandon mix()? (#9343)

> Good news: the spec already says exactly this: [...]

Are you sure? Wouldn't the current spec cause e.g. the computed value of `float: mix(left; right; 10%)` to literally be `mix(left; right; 10%)`?

> If the two <declaration-value>s in mix() are interpolable (without using mix() itself) as values for the property in which it is specified, the computed value of mix() is the result of interpolating these two values to the progress given by the <percentage>. 

`left` and `right` are not interpolable, so this does not apply, which means that we fall into:

> Otherwise, the **computed value of mix() is the mix() functional notation itself** with its <percentage> computed and both <declaration-value>s computed as values for this property.

So we end up with `mix(left; right; 10%)`. This is not a situation that can happen with with regular animations. Yes, allowing this in a few problematic cases was the point of adding this in the first place (again: https://github.com/w3c/css-houdini-drafts/issues/425), so we'd of course have to let `mix()` be the computed value in those cases. But I allowing it _genreally for everything_ is going to far, as we'd need to be able to represent lots of expensive computed values internally (`mix(left; right; 10%)`) for no practical benefit.

> That said, we do have several functions which are essentially specialized mix() versions: color-mix(), palette-mix(), cross-fade(). It is possible for us to just add more specialized functions as needed (a transform-mix()?)

The good thing about `color-mix()` is that it isn't that special. It's just another thing allowed by `<color>`. This means `color-mix()` can be used wherever `<color>` goes, be it top-level or other places. So I do think `transform-mix()` and generally `specific-thing-mix()` is a better approach, _even_ if they don't offer any special interpolation behavior.

That said, if we still really want `mix()`, we can make it more approachable by resolving it computed-value time by default (also for discrete animations).

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


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

Received on Friday, 15 September 2023 09:29:02 UTC