Support for custom view transition animations #582
Replies: 2 comments 2 replies
-
I'm working on this already. The design of the view transitions API is a bit weird and I want to get the way we support it right. Here are just a few of the ways things are annoying:
Supporting view transitions within StyleX was basically impossible until the I also have no idea if and when Firefox will implement any of these APIs. For the APIs that are already supported, StyleX already can be used for them. Which, sadly, means authoring a separate CSS file for globals. |
Beta Was this translation helpful? Give feedback.
-
Glad to hear it's in the works, @nmn !
Since the transition name is globally unique, it probably doesn't need to be in the generated stylesheet. i.e. It might be better to have I'm not sure if
Anyway, thanks for the details! Really looking forward to see how this evolves! |
Beta Was this translation helpful? Give feedback.
-
One of the biggest benefits of StyleX over its alternatives is being able to define complex rules like keyframes and animations in the component that uses them.
Unfortunately there's an exception to this when it comes to the View Transitions API, which should be entering Baseline Newly Available very shortly. If we want to define a custom animation for the
::view-transition()
pseudoelements, this can't be done in thestylex.create()
alongside the component that uses them, since they need to be attached to the document root.It would be useful if we could define
::view-transition(name)
,::view-transition-group(name)
,::view-transition-image-pair(name)
,::view-transition-new(name)
and::view-transition-old(name)
in a StyleXcreate()
definition (or through a dedicated mechanism similar tostylex.keyframes()
) and have them exist unconditionally (without being attached via props to an element) in the generated CSS file. That way, if a component I'm writing needs a view transition defined, I can keep its definition with the rest of its styles, rather than move them to the top-level CSS document.Beta Was this translation helpful? Give feedback.
All reactions