Open rthrejheytjyrtj545 opened 1 year ago
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.
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.
@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?
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 liketransition-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.