Playground: change the numbers and watch what happens.
Four small experiments. Each one shows how a single setting changes the feel of a scroll site, and prints the line of code to copy.
What you will learn
By the end of this chapter- 01Feel how smoothing, parallax speed, stagger and easing change the mood of a page.
- 02Choose values on purpose and write them down as design decisions.
- 03Copy the exact line of code each setting produces.
- 04Keep motion values consistent across the whole site.
01 · Smoothing
Lenis lerpLenis moves the page a fraction of the way to where you scrolled on every frame. That fraction is lerp. Click or drag on the bar to set a target.
new Lenis({ lerp: 0.1 })Low values feel heavy and slow. High values feel close to normal scrolling. The documented default is 0.1.
02 · Parallax
Layer speedScroll inside the box. The dots follow the formula from the example: translateY = scroll × (1 − speed).
layer.style.transform = 'translate3d(0,' + (y * (1 - 0.4)) + 'px,0)'Speed 1 moves with the page and shows no depth. Speed 0 stays pinned to the page. Values between 0.15 and 0.5 read as depth. Past about 0.6 it tends to look like a fault.
03 · Stagger
Reveal timing.reveal { transition-delay: calc(var(--d) * 100ms); }Short delays read as one movement. Long delays read as a list being counted out. Keep the whole sequence under about a second.
04 · Easing
Cubic Beziertransition: transform .9s cubic-bezier(0.2, 0.7, 0.2, 1);The reveal curve starts fast and settles gently, which is why the example site uses it. Linear motion looks mechanical on interface elements.
Practice · Work with AI
The same task in your toolThe playground gives you numbers. These prompts turn them into one place in the code, so the whole site moves with the same character.
Open a terminal in the project folder and run claude. Press Shift+Tab until plan mode is on, paste the prompt, read the plan, then approve it. Project rules go in CLAUDE.md.
Apply the values
Read CLAUDE.md. Collect every motion value in the site for [subject] into one place: the Lenis lerp, the parallax speed, the reveal stagger and the easing curve, as CSS custom properties and one JavaScript object. Use these values: lerp [value], parallax speed [value], stagger [value] ms, easing [cubic-bezier]. Replace the hard-coded numbers and list every line you changed.Find stray values
Search the CSS and JavaScript for durations, delays, easing curves and speeds that do not come from the shared motion values. List each one with its file and line. Do not change them yet.Open a terminal in the project folder and run gemini; the first time, it asks whether you trust the folder, so say yes for your project. Paste the prompt. Gemini CLI asks before it edits a file or runs a command: read each request before you accept it. Project rules go in GEMINI.md.
Apply the values
Read GEMINI.md. Collect every motion value in the site for [subject] into one place: the Lenis lerp, the parallax speed, the reveal stagger and the easing curve, as CSS custom properties and one JavaScript object. Use these values: lerp [value], parallax speed [value], stagger [value] ms, easing [cubic-bezier]. Replace the hard-coded numbers and list every line you changed.Find stray values
Search the CSS and JavaScript for durations, delays, easing curves and speeds that do not come from the shared motion values. List each one with its file and line. Do not change them yet.Open a terminal in the project folder and run codex, then paste the prompt and approve each change. In the ChatGPT app without Codex, attach the files, paste the prompt and copy the changes back yourself. Project rules go in AGENTS.md.
Apply the values
Read AGENTS.md. Collect every motion value in the site for [subject] into one place: the Lenis lerp, the parallax speed, the reveal stagger and the easing curve, as CSS custom properties and one JavaScript object. Use these values: lerp [value], parallax speed [value], stagger [value] ms, easing [cubic-bezier]. Replace the hard-coded numbers and list every line you changed.Find stray values
Search the CSS and JavaScript for durations, delays, easing curves and speeds that do not come from the shared motion values. List each one with its file and line. Do not change them yet.Practice · Exercises
Try first, then compareCalm versus lively
Find a smoothing value that feels calm and one that feels lively. Write both down with one word for each feeling.
Hint: a lower lerp follows the wheel more slowly.
Show the solution
Around 0.06 to 0.08 feels calm and heavy; around 0.12 to 0.15 feels responsive and light. Very low values make the page feel late, which reads as lag rather than calm.
Depth without nausea
Set the parallax speed so the layers feel deep but the text never drifts far from where the reader expects it.
Hint: move the background, not the words.
Show the solution
Keep text layers at speed 1 (moving with the page) and move only the background, at roughly 0.6 to 0.8. Large speed differences on text make reading harder and can cause discomfort.
One curve
Pick a single easing curve for every reveal on your site and explain why it fits [subject].
Hint: an ease-out starts fast and settles.
Show the solution
A strong ease-out such as cubic-bezier(.2, .7, .2, 1) arrives quickly and settles gently, which reads as confident and calm. Use it for every reveal; keep linear timing for scrubbed scenes, where the scroll is the easing.
Practice · Course project
One site, built across the courseTurn your choices into the motion settings of the site for [subject], so every effect shares them.
- Try each of the four experiments and note the values you like.
- Add the values to
style.cssandapp.jsas below, then run “Apply the values”. - Run “Find stray values” and fix what it lists.
:root {
/* motion: chosen in the playground */
--reveal-duration: .9s;
--reveal-stagger: 80ms;
--ease-out: cubic-bezier(.2, .7, .2, 1);
}
/* app.js */
/* const MOTION = { lerp: 0.09, parallax: 0.7, stagger: 80 }; */Practice · Test it
Check the result- Every duration, delay, easing and speed in the code comes from the shared values.
- Changing
--reveal-durationin one place changes every reveal on the page. - Scrolling with a mouse wheel and with a trackpad both feel smooth, neither late nor jumpy.
Practice · Assessment
Acceptance criteria0 of 3 criteria met