Description
Is your feature request related to a problem? Please describe.
We did some work recently to replace the default transitions with custom ones to avoid the injection/removal of custom @keyframes
rules into a stylesheet every time we run a svelte transition. It causes at least one full-page repaint every time, which for game UI is real rough.
Our custom transitions don't use css
or tick
, they mostly take the params and apply them to elements using inline style
attributes and predefined keyframe animations. That part is all working great.
The challenge is that our custom transitions, because they don't use css
or tick
, don't know which direction they should be transitioning, it's not passed as part of the params.
https://svelte.dev/repl/8297026848b64192ad8faa46120c9700?version=3.14.1
Describe the solution you'd like
I'd like a new property added to the params
object passed to transition functions. I don't have a strong opinion about what it should be called. The property would have 3 possible values, in
, out
, both
.
Describe alternatives you've considered
Our current solution is to define a transition function that takes an extra argument, then export bound versions of that function where the first argument is either in
or out
. This works ok, but is awkward and annoying to have to use multiple imports if you want to fade an element in or out.
Given how our transitions work and how svelte calls transition functions we still wouldn't be able to use transition:custom
, but that's fine. No longer need to import { inFade, outFade } from "transitions"
would be a big step in the right direction and simplify our lives appreciably.
How important is this feature to you?
This isn't a deal-breaker, we have a workaround. It's just unpleasant and slightly error-prone at the moment since it's possible to assign the wrong transition to either the in:
or out:
, whereas with this proposal it would work even more like the transitions that are built into svelte.