Skip to content

[css-variables] When does substitution occur, before or after animation interopolation? #411

@gregwhitworth

Description

@gregwhitworth

I think the spec could be a little bit more clear on when substitution actually occurs for custom properties. We know that they happen during computed value time, but this doesn't get into the minutia of whether or not this occurs before the animation interpolation or after.

If you take the following example, what should happen:
http://jsbin.com/busapezohu/1/edit?html,css,output

Chrome: No background is painted for either div
FF: Second div background is transitioned

Currently the spec states the following:

Notably, they can even be transitioned or animated, but since the UA has no way to interpret their contents, they always use the "flips at 50%" behavior that is used for any other pair of values that can’t be intelligently interpolated. However, any custom property used in a @Keyframes rule becomes animation-tainted, which affects how it is treated when referred to via the var() function in an animation property.

This seems to state that they should work, but that it may not be possible to correctly interpolate a custom property (as seen in the test animation since it's merely an ident at that point). So I would suggest that what Firefox is doing is the correct outcome, that you do substitution first and then any animation interpolation once we know the value and the property it is applied to is blue we can correctly interpolate to that of blue (as seen in the regular testcase).

This may even want to be taken over to the cascade specification where we get more specific about when certain things happen during various stages, in this case Computed Value time.

cc: @shans as this is what I was pinging you about :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions