Re: [csswg-drafts] Animation and opacity clamping (#3340)

As it currently stands, I believe the Firefox behavior is correct because, as Xidorn points out, animation is defined as operating on computed values and the clamping happens at computed value time.

Firefox does support negative computed opacity values and negative computed color values but it is only turned on for SMIL.

In future I believe we will want to allow out of range values in order to support [additive CSS](1594) (e.g. `opacity: -0.5 !add`) and [additive animation](https://drafts.csswg.org/web-animations-1/#effect-composition) (c.f. the proposed [animation-composition](https://drafts.csswg.org/css-animations-2/#animation-composition) property).

We could say that out of range computed values are only allowed in the presence of some additive operation and maintain the current Firefox behavior for existing content, or we could try to shift  clamping to happen at used value time as per SMIL, assuming that is Web-compatible.

For reference, the [SMIL](https://www.w3.org/TR/smil-animation/#AnimationSandwichModel) has the following recommendation in this area:

> Some attributes that support additive animation have a defined legal range for values (e.g., an opacity attribute may allow values between 0 and 1). In some cases, an animation function may yield out of range values. It is recommended that implementations clamp the results to the legal range as late as possible, before applying them to the presentation value. Ideally, the effect of all the animations active or frozen at a given point should be combined, before any clamping is performed. Although individual animation functions may yield out of range values, the combination of additive animations may still be legal. Clamping only the final result and not the effect of the individual animation functions provides support for these cases. Intermediate results may be clamped when necessary although this is not optimal.

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

Received on Monday, 26 November 2018 00:38:11 UTC