0Pricing
Sveltejs Academy · Lesson

Transition Parameters: node duration delay

Accept a node and parameters object in your transition function for flexibility.

Transition Parameters: node duration delay is a free Sveltejs Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Sveltejs Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Function Signature

Custom transitions accept (node, params) for flexibility.

Reading node

Use the node to compute properties like its current size or position.

const rect = node.getBoundingClientRect();

Pass Parameters

The consumer passes params with the directive.

<p transition:spin={{ duration: 800 }}>...

Defaults

Handle missing params with default values inside the function.

function spin(node, { duration = 600 } = {}) { ... }

Reactive Params

Param changes do not re-run a transition mid-flight; the next mount uses the new value.

Computed Duration

You can compute duration from data, like word length for typewriter effects.

Easing Param

Accept an easing parameter for consumers to customize the curve.

Delay Param

Stagger entries by passing a delay derived from an index.

{#each items as item, i}
  <p transition:fly={{ delay: i * 50 }}>{item}</p>
{/each}

CSS String Tips

Return composable transforms; avoid layout-thrashing properties like top/left.

Performance

Stick to transform and opacity for buttery smooth animations.

Testing

Inspect computed styles during a transition with browser DevTools.

Quick Check

What does the params object provide?

Recap

Accept and use params for flexible transitions. Provide defaults for missing values.

Frequently asked questions

Is the “Transition Parameters: node duration delay” lesson free?

Yes — the full text of “Transition Parameters: node duration delay” is free to read here on the web, and the Sveltejs Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Sveltejs Academy course, upgrade to CoddyKit PRO.

What will I learn in “Transition Parameters: node duration delay”?

Accept a node and parameters object in your transition function for flexibility. You practise Sveltejs Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Sveltejs Academy?

No prior experience is required. Sveltejs Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Transition Parameters: node duration delay” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Sveltejs Academy lesson?

Yes. Every Sveltejs Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Writing a Custom Transition Function
  2. Transition Parameters: node duration delay
  3. Creating a morphing Transition
  4. CSS vs JS Transitions
← Back to Sveltejs Academy