0
0
Svelteframework~5 mins

In and out transitions in Svelte - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are in and out transitions in Svelte?
In and out transitions in Svelte are animations that run when a component or element enters (in) or leaves (out) the DOM. They help make UI changes smooth and visually clear.
Click to reveal answer
beginner
How do you apply an in transition to an element in Svelte?
Use the in: directive followed by the transition function name, like in:fade. For example: <div in:fade>Hello</div>.
Click to reveal answer
beginner
Name two built-in transitions provided by Svelte.
Two built-in transitions are fade (fades element in/out) and slide (slides element in/out from a direction).
Click to reveal answer
beginner
What is the difference between in: and out: directives in Svelte?
in: runs the transition when an element appears in the DOM. out: runs the transition when the element is removed from the DOM.
Click to reveal answer
intermediate
How can you customize the duration of a Svelte transition?
Pass an options object to the transition function, like in:fade={{ duration: 500 }} to make the fade last 500 milliseconds.
Click to reveal answer
Which directive applies a transition when an element is removed from the DOM in Svelte?
Aout:
Bin:
Ctransition:
Danimate:
What does the built-in fade transition do in Svelte?
ASlides the element in and out
BRotates the element
CChanges the element's opacity gradually
DScales the element up and down
How do you specify a 1-second duration for a fade transition in Svelte?
Atransition:fade duration=1000
Bin:fade(1000)
Cfade:duration=1000
Din:fade={{ duration: 1000 }}
Which of these is NOT a built-in Svelte transition?
Abounce
Bfly
Cslide
Dfade
What happens if you use both in: and out: on the same element?
AOnly the in transition runs
BBoth transitions run on enter and leave respectively
CIt causes an error
DOnly the out transition runs
Explain how to add a fade-in and fade-out effect to a Svelte element using built-in transitions.
Think about how to tell Svelte what to do when the element appears and disappears.
You got /3 concepts.
    Describe the difference between in and out transitions in Svelte and when each runs.
    Consider the element's lifecycle in the page.
    You got /3 concepts.