Skip to content

Svelte 5: Transition easing functions aren't reversed during out transition #9937

@aradalvand

Description

@aradalvand

Describe the bug

Take cubicOut as an example; in Svelte 4, this is what it looks like (see REPL):

Rec.0004.mp4

Nice and graceful.

Now, in Svelte 5, however, the same exact code yields a very different "out" transition (see REPL):

Rec.0005.mp4

Which fails to reverse the easing, and thereby creates a jarring look; this is presumably because internally Animation.reverse() is being called for the out transition, which results in the latter type of "reversing". But this never looks good; Svelte 4's way of "reversing" the transition was the "correct" one. The Web Animations API's reverse() method doesn't reverse the easing, which, again, feels jarring and isn't normally what you want; so just calling reverse() isn't sufficient on its own.

There is presumably some way to simulate the former behavior using the Web Animations API, but I haven't looked into that.

It's worth noting that the former behavior is also how plain old CSS transitions (+ toggling classes) work (i.e. they also reverse the easing); so, as I said, Svelte 4 is the one doing the most natural/expected thing here. Svelte 5 should follow suit.

Reproduction

See the REPLs linked above.

Logs

No response

System Info

N/A (see the REPLs)

Severity

blocking an upgrade

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions