Complete the code to add a fade transition with a duration of 500ms.
<script> import { fade } from 'svelte/transition'; </script> <div transition:fade={{ duration: [1] }}> Hello, Svelte! </div>
The duration parameter controls how long the transition lasts in milliseconds. Here, 500 means the fade will take half a second.
Complete the code to add a slide transition with a delay of 300ms.
<script> import { slide } from 'svelte/transition'; </script> <p transition:slide={{ delay: [1] }}> Slide me in! </p>
The delay parameter sets how long to wait before starting the transition. 300 means it waits 300 milliseconds before sliding.
Fix the error in the code to correctly apply a fade transition with a 700ms duration.
<script> import { fade } from 'svelte/transition'; </script> <div transition:fade={{ duration: [1] }}> Fade me! </div>
The duration must be a number representing milliseconds, not a string or a decimal.
Fill both blanks to create a fade transition with 400ms duration and 200ms delay.
<script> import { fade } from 'svelte/transition'; </script> <span transition:fade={{ duration: [1], delay: [2] }}> Smooth fade! </span>
The duration is how long the fade lasts, and delay is how long to wait before starting it.
Fill all three blanks to create a slide transition with 600ms duration, 150ms delay, and easing set to cubicInOut.
<script> import { slide } from 'svelte/transition'; import { cubicInOut } from 'svelte/easing'; </script> <div transition:slide={{ duration: [1], delay: [2], easing: [3] }}> Slide with easing! </div>
Duration and delay are numbers in milliseconds. Easing is a function imported from svelte/easing to control the speed curve.