-
Notifications
You must be signed in to change notification settings - Fork 707
[css-easing] Should we include the infinity for output progress value? #8344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note: I notice this when working on https://bugzilla.mozilla.org/show_bug.cgi?id=1807966. |
I don't believe it's actually possible to produce an infinite value from any predefined easing function anyway, so yeah, adjusting the range to be exclusive at both ends sounds good. |
Yeah, we recognized that there are currently no cases where the output can be +/- Infinity and changed the progress accordingly here: w3c/web-animations@df138ee |
@birtles @tabatkins but that's not quite right is it? Output can be infinite / nan if you use |
Example from the above Gecko bug: |
Yes, you're right. The spec edit I pointed to was from before the Since |
We could make infinite values result in an invalid |
|
hmm, shouldn't that per spec be actual infinity (or let's say, I guess https://drafts.csswg.org/css-values-4/#calc-computed-value doesn't quite specify what's the actual computed value of a |
https://drafts.csswg.org/css-values-4/#calc-range
|
Getting back to Boris' question about the For infinite values perhaps we could let (I'm away from my computer now though so I haven't checked the Gecko bug to see if that works there.) |
Can't do "invalid", since it's not always detectable at parse time. But yeah, as Oriol said calculations don't actually resolve to infinite values; they're clamped to something large (but undefined) by definition. So no, a linear() can't actually resolve to an infinite value. (A given context could define that infinite values are allowed and so something specific with them, but none do currently, and we probably shouldn't without a great reason. In particular, doing anything different from "very large but finite" is probably a bad idea, and if you are consistent with "very large but finite", just relying on the implicit clamping is probably sufficient anyway.)
Yeah, the lack of a specified max is intentional; the actual value doesn't actually matter (any similarly-enormous number will do effectively the same thing in whatever context it appears in), and actually setting values would require a lot of extra research and specification effort. Just wasn't worth the cost for whatever minimal benefit consistency would bring us. |
We should probably handle at least NaN values there. For infinite values we could clamp there or we try to clamp them as part of the interpolating step or even later still. The latter will require ensuring infinite progress values are correctly handled by other parts of the system prior to interpolating (e.g. making |
…g function. r=emilio The output progress of easing functions could be inf or -inf, per spec, https://drafts.csswg.org/css-easing-2/#output-progress-value. But we should avoid using infinity to calculate interpolation or use the infinite progress in Web Animations API, per the spec issue comments: w3c/csswg-drafts#8344 (comment) Differential Revision: https://phabricator.services.mozilla.com/D167342
…g function. r=emilio The output progress of easing functions could be inf or -inf, per spec, https://drafts.csswg.org/css-easing-2/#output-progress-value. But we should avoid using infinity to calculate interpolation or use the infinite progress in Web Animations API, per the spec issue comments: w3c/csswg-drafts#8344 (comment) Differential Revision: https://phabricator.services.mozilla.com/D167342
The output progress of easing functions could be inf or -inf, per spec, https://drafts.csswg.org/css-easing-2/#output-progress-value. But we should avoid using infinity to calculate interpolation or use the infinite progress in Web Animations API, per the spec issue comments: w3c/csswg-drafts#8344 (comment) Differential Revision: https://phabricator.services.mozilla.com/D167342
The output progress of easing functions could be inf or -inf, per spec, https://drafts.csswg.org/css-easing-2/#output-progress-value. But we should avoid using infinity to calculate interpolation or use the infinite progress in Web Animations API, per the spec issue comments: w3c/csswg-drafts#8344 (comment) Differential Revision: https://phabricator.services.mozilla.com/D167342
The output progress of easing functions could be inf or -inf, per spec, https://drafts.csswg.org/css-easing-2/#output-progress-value. But we should avoid using infinity to calculate interpolation or use the infinite progress in Web Animations API, per the spec issue comments: w3c/csswg-drafts#8344 (comment) Differential Revision: https://phabricator.services.mozilla.com/D167342
The output progress of easing functions could be inf or -inf, per spec, https://drafts.csswg.org/css-easing-2/#output-progress-value. But we should avoid using infinity to calculate interpolation or use the infinite progress in Web Animations API, per the spec issue comments: w3c/csswg-drafts#8344 (comment) Differential Revision: https://phabricator.services.mozilla.com/D167342
You still can't get a NaN. If you try and write either into the syntax, like And you can't get a NaN in the output, either - none of the functions allows that to happen. Both linear() and cubic-bezier() have matching discontinuous behavior if the extrapolation line would actually be vertical, instead treating the first/last point as giving a constant output value. You can potentially get an infinity, if you use a sufficiently sloped function and a sufficiently large/small input outside of the 0-1 range, but that should ideally be clamped as well, since it's an artifact of translating it to a JS double. So that should occur at the WebAnimations side, I think. I can put a note in Easing about it, tho. |
Closing as invalid; CSS already theoretically allows infinities, and implicitly does UA-defined clamping (defined in Values 4). For any non-CSS usage of easing functions, they'll need to define what happens with values that are large enough to be treated as infinity - they can clamp, or use infinity natively, as they wish. NaNs are censored so they don't escape a calc(), and none of the easing functions can directly produce a NaN on their won. |
The definition of output progress value in [css-easing] includes the infinity:
However, there are some mismatched places in other specs:
double
instead ofunrestricted double
. That means the progress doesn't include infinity or NaN.Do I misread something? Or should we update the definition of output progress value and let it exclude infinity in [css-easing]? Or do we have to update other specs to match [css-easing]?
IMO, I prefer letting [css-easing] restrict the range of output progress value from easing functions because it makes more sense to me, i.e. use
(-∞, ∞)
, instead of[-∞, ∞]
.cc @birtles
The text was updated successfully, but these errors were encountered: