-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Svelte 5: delayed transitions don't apply initial CSS #10876
Comments
|
Is there any workaround for this issue? Quite the annoying one |
A workaround would be to remove the delay and instead provide a custom <script>
import { fade } from "svelte/transition";
import { linear } from "svelte/easing";
function workaroundSvelte5BugWithDelay({ delay, duration, easing = linear }) {
let virtual_duration = delay + duration;
let threshold = delay / virtual_duration;
return {
duration: virtual_duration,
easing: (x) => x < threshold ? 0 : easing((x - threshold) / (1 - threshold)),
};
}
</script>
<div in:fade={workaroundSvelte5BugWithDelay({ delay: 500, duration: 300 })}>hello</div> |
WAAPI applies the styles of a delayed animation only when that animation starts. In the case of fade-in transitions that means the element is visible, then goes invisible and fades in. Fix that by never applying a delay on intro transitions, instead add keyframes of the initial state for the duration of the delay. Fixes #10876
* fix: properly delay intro transitions WAAPI applies the styles of a delayed animation only when that animation starts. In the case of fade-in transitions that means the element is visible, then goes invisible and fades in. Fix that by never applying a delay on intro transitions, instead add keyframes of the initial state for the duration of the delay. Fixes #10876 * fix bug, make test pass * make test more selfcontained, test outro delay aswell and add functionality for that in animation-helpers * lint --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>
Describe the bug
If a transition has a delay, it should begin in its
0
state, not its1
stateReproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE02PwW4DIQxEf8Ulh7RSJXLphbIr5TuaHDaLiayygMAbKUL8e2HTKr15rHljTxGWHGahvorw04JCiWOM4l3wPXaRb-gYm85hTXPf6Dwnijye_IlpiSExFLCTQahgU1hg_2Akp8lnYgp-_9nNDhlulOniEIZGuIxtr-Uzz-vLyhw8BK9mR_P3UF7fYBj_YS-_Yx05XK8OtXwgG152ZP-8tZ_UEZ5fqP7kUIpBN90VfBwOtY6bQLMV0DK2mCLJVmiNl2DIEhqhOK1Yz_UHA4G56ywBAAA=
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: