-
Notifications
You must be signed in to change notification settings - Fork 715
[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<TabAtkins> flackr: currently, we only have animation-timing-function, which sets easing between keyframes<TabAtkins> flackr: Web Anim also lets you set an easing across the netire animation <TabAtkins> flackr: i think we discussed this previously, but I ahve a conrete proposal now <TabAtkins> flackr: hopefully can resolve <TabAtkins> flackr: 'animation-easing' property that sets the iteration-wide easing of the animation, defined the same as Web Animation <TabAtkins> flackr: setting this property to a non-default value (which implies we need 'auto') would reset animation-timing-function to 'linear' by default <TabAtkins> flackr: becuase a-t-f defaults to ease, you probably don't want that by default if the whole animation is eased <TabAtkins> flackr: but you *can* specify both if you want <TabAtkins> flackr: a use-case for doing both is a step animation that eases the timing of the steps <astearns> ack fantasai <Zakim> fantasai, you wanted to ask about compounding easing vs resetting <TabAtkins> fantasai: I think having a shorthanding relationship is gonna be confusing <TabAtkins> fantasai: if the concern is the initial value, we should change the a-t-f initial vlaue to something else that computes to linear or ease, depending <TabAtkins> fantasai: that way if yous pecify both it works regardless of order <TabAtkins> fantasai: other than that, makes sense <TabAtkins> dbaron: clarify, the idea is not that it's some new type of easing, it's jsut setting the easing between every set of keyframes? <TabAtkins> flackr: No, that's what a-t-f does, this is the animation-easing form WebAnim <TabAtkins> dbaron: don't know what that does <TabAtkins> flackr: It changes the time for the whole animation <TabAtkins> dbaron: okay so your 50% keyframe isn't at 50% of the time, it's eased in some way <TabAtkins> flackr: yes, and this is already widely implemented in Web Anim, it's not new behavior <TabAtkins> flackr: proposed resolution is we add the 'animation-easing' as defined in the issue, and add a new initial value for animation-timing-function to something that computes to ease or linear depending on animation-easing <emilio> q+ <astearns> ack dbaron <astearns> q+ ydaniv <TabAtkins> fantasai: just wanna make *sure* you want to change the default from ease <TabAtkins> TabAtkins: yes, stacking 'ease' in both whole aniamtion and keyframes looks really bad most of the time <TabAtkins> flackr: and Web Anim defaults all of them to linear anyway, the 'ease' default is from CSS <fantasai> what should this keyword be though. 'normal'? 'auto'? 'none'? <TabAtkins> emilio: to be clear, we add some 'auto' value to a-t-f so it looks at animatino-easing? <ydaniv> q- <TabAtkins> flackr: yes <astearns> ack emilio <TabAtkins> emilio: and presumably in animation-easing too, to distinguish it from an author-set linear <TabAtkins> flackr: yes <TabAtkins> emilio: and so the two share the syntax <TabAtkins> flackr: yes <TabAtkins> emilio: that sound ok <TabAtkins> emilio: so if they're both auto, you get linear a-easing and 'ease' a-t-f <TabAtkins> emilio: so this would be part of the animation shorthand presumably? <TabAtkins> flackr: that's a separate issue <TabAtkins> astearns: so proposed resolution to add animation-easing and a new initial value for a-t-f <TabAtkins> emilio: do we need to *compute* the a-t-f value? <TabAtkins> TabAtkins: probably can't change the observable initial vlaue <TabAtkins> emilio: maybe another resolved value exception... <TabAtkins> emilio: do we need the same thing for transitions <TabAtkins> TabAtkins: transitions only have one keyframe, so no, not yet <TabAtkins> flackr: you can attach keyframes to transitions with Web Anim, but then you have access to animationEasing again <fantasai> We're also resolving this right? https://github.com//issues/8881 <TabAtkins> RESOLVED: add the 'animation-easing' as defined in the issue, and add a new initial value for animation-timing-function to something that computes to ease or linear depending on animation-easing <TabAtkins> TabAtkins: yes, this closes 8881 too <fantasai> scribenick: fantasai |
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: