Skip to content

[css-animations] [css-transitions] Allow authors to control the time threshold for properties with a discrete animation type #9409

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

Open
bleper opened this issue Sep 26, 2023 · 3 comments

Comments

@bleper
Copy link

bleper commented Sep 26, 2023

It would be useful to give authors the ability to apply magic of a properties, such as content, display, content-visibility, visibility & overlay, on arbitrary properties; and make it more flexible. Something like transition-step, which accepts a list of single values from percentage, start, middle, end & auto.

I know these days this is solved by playing with keyframes or transition durations / delays, but there is a reason why certain properties have special rules, so having a common primitive for something like this would be quite helpful.

Use cases could be disabling at the start of hiding / enabling at the end of showing interactions, for example through user-select, pointer-events, touch-action, resize, overflow, overscroll-behavior & scrollbar-width; or custom properties, the values of which trigger style containers.

It might also be worth considering forcing a discrete animation type, on demand, as an aid to development for users with reduced motion needs. So that the intended property will set it for the affected properties, with the option to revert to the previous behavior via the initial normal value.

@Loirooriol
Copy link
Contributor

Why not do it with an easing function? If you want to e.g. change at 25%, use linear(0, 0.5 25%, 1), or step-start to change at the very beginning, etc.

@bleper
Copy link
Author

bleper commented Sep 27, 2023

In animations, the ease function is set for the entire animation. And specifying additional animations only for use in conjunction adds unnecessary complexity to the code and increases the likelihood of errors.

The same thing applies to transitions. There is no way to set the ease function only for a group of discrete properties, except by listing all the properties involved in the transition and setting for each of its values, which causes a lot of duplication, since authors usually use all together with a single ease function.

@ydaniv
Copy link
Contributor

ydaniv commented May 1, 2024

@rthrejheytjyrtj545:

In animations, the ease function is set for the entire animation. And specifying additional animations only for use in conjunction adds unnecessary complexity to the code and increases the likelihood of errors.

actually no, in CSS the timing-function is applied per keyframe, see #6982. Only on Web Animations you can set easing per entire iteration.

The same thing applies to transitions. There is no way to set the ease function only for a group of discrete properties, except by listing all the properties involved in the transition and setting for each of its values, which causes a lot of duplication, since authors usually use all together with a single ease function.

I disagree on that. This is exactly the reason we have the ability to set multiple transitions, so that you can configure it per property. You can also start with a default for all and then override later in the list.

Nevertheless, I think the OP might be useful. Can you give example demos (codepen/jsbin/etc) of concrete use-cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants