-
Notifications
You must be signed in to change notification settings - Fork 719
[css-animations-2] there should be a way to set the effect-wide easing for a CSS Animation #6982
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
Perhaps we could accept 2 values of Another option, if we go with animation-easing: linear ease; Which would make it backwards compat with But this option might still be confusing when mapped to Web Animations. |
I'm not attending TPAC I'm afraid but I don't have particularly strong opinions on this. I tend to prefer @graouts original proposal simply because having a shorthand that puts the keyframe effect first seems a little awkward. Most often authors will only want to set the effect-wide easing (more accurately, iteration-wide, but hey) so having to write |
In terms of things we agree on, I think everyone agrees we want a way to set effect-wide easing from CSS. I think most of us would like, if possible, to transition towards using the "easing" terminology over the more verbose "timing function" terminology because that's the name of the member in the Web Animations API and the name of the spec that defines these easing functions. |
Another way tackle this could be introducing a new separated property that controls the "mode" of the specified easing to control whether timing function in shorthands are used per keyframe or per iteration. * {
animation-easing-mode: iteration; /* or `keyframe` */
} And then, like in the above example, you can set it once as default for all and only override where/if needed otherwise. |
I think that would work but I still prefer @graouts' original proposal for its simplicity. Is there any particular concern with that proposal? |
There's no problem, I'm only trying to find a simple way forward to have that easing property work in |
I think more detail is needed about what exactly is meant by "disregarded". I believe what you intend is that the default .target {
animation: my-animation 1s;
animation-easing: linear;
} So I think to do this we would have to have an For a slightly different proposal, we could treat E.g. an author could explicitly reset the .target {
animation: my-animation 1s; /* animation-timing-function is initially ease as always */
animation-easing: steps(10); /* implicitly sets animation-timing-function to linear. */
animation-timing-function: ease; /* explicitly sets animation-timing-function back to ease. */
} One challenge about this entire space is that it will still be difficult to add the effect-wide easing to the animation shorthand since it would have to come second there anyways without some other syntax to specify that you want to set the effect-wide easing. E.g. .target {
animation: my-animation 1s ease steps(10);
} |
How would setting the iteration-wide easing inside a keyframe work? Would it reset the progress from that point? If not, what use-cases would that serve?
If we add another
I thought that was the initial proposal. You mean it would treat the Another option we can consider for solving the shorthand problem is using a new "mode" property like I suggested above. |
The proposed One downside though, is that you’re then limited to either effect-timings or either keyframe-timings – you can’t have both. Not sure if that’s a limitation that would bother most people or not. Another approach is to not auto-set As for the shorthand: that’s a recurring problem which I don’t think we’ll be able to solve here. |
It would not be a valid property inside a keyframe, like other animation affecting properties.
If we used auto, I'd propose it is only specified through omission.
I'm a bit confused here. If animation-easing is unspecified, then the animation easing will be linear (as it is today), and the animation-timing-function will have its default ease value unless another is specified by the developer. If the developer sets
I'm not a fan of changing the interpretation of the timing function, but accept this may be the direction we have to go here. |
That's a good point. I'm trying to think about use-cases but can't think of any. I guess authors could as well do something like: * {
animation-timing-function: linear;
} And then only work on
Yes, that was my thought.
Right, that sounds good, still leaving us with the shorthand problem.
OK, I wasn't sure this is possible via an unspecifiable/ommitted To sum it up, I think we have an agreed way forward for reseting keyframe-wide to |
We could also go with a solution that allows setting only the iteration-wide function and then authors could still override in the |
Reading through this again, I think I didn't understand @flackr's suggestion before, but I think I got it now 😅 So, what if we made Also, like suggested above, allowing So in short, I propose to accept @flackr's suggestion above, with the suggested |
Summarizing proposal: add |
The CSS Working Group just discussed
The full IRC log of that discussion |
So, followup things that need issues:
|
The animation shorthand issue: #6946. We probably need to address |
Currently, the
animation-timing-function
property set on an element will set the default value foranimation-timing-function
for each keyframe of a@keyframes
applied to that element. This means that there is no way to set the easing for an animation effect, only on its keyframes, thus not allowing authors to specify a CSS Animation with multiple keyframes with a single easing being applied throughout.This always bugged me and resurfaced while discussing #6974 with @birtles.
One idea @birtles suggested in this conversation would be to add a new
animation-effect-timing-function
property which would apply animation-wide. This is a good suggestion.An alternative I could think of would be to use the term
easing
since this is the name of the property used in the Web Animations specification and also the term used in the CSS Easings specification. Thus, we could introduce a newanimation-easing
property.That property could apply to keyframes as well, where the
animation-easing
property would override the value set on the element for this particular keyframe. And if theanimation-easing
is set on either the element or a keyframe, then theanimation-timing-function
values would be completely disregarded, therefore deprecating that property in favor of the newanimation-easing
which I think would be more user-friendly.The text was updated successfully, but these errors were encountered: