3D Scroll Website Prompts for Claude, Ready to Copy
By Md Mahafuj Alam · Updated
How to use these prompts
The prompts assume a Next.js App Router project with TypeScript, gsap, @gsap/react, lenis and three installed, frames in public/frames/, and a CLAUDE.md that states the stack and rules. If you have not set that up, start with Claude Code setup for 3D scroll websites. For where these steps sit in the whole workflow, see the complete guide to building a 3D motion website with Claude.
- Run them in order. Each prompt builds on the files the previous one created.
- One prompt per task. Commit after each one works, then run
/clearbefore the next so old attempts do not crowd the context. - Edit the brackets. Anything in square brackets is yours to fill in: frame counts, chapter names, colours.
- Use plan mode for the bigger ones. Anthropic's best practices suggest planning first when a change touches several files. Press
Shift+Tabto switch modes.
Foundation: the sequence player and scroll engine
1. Scaffold the scroll-sequence component
Use this first, with one chapter's frames in place. Everything else depends on this component being right.
Create components/scroll/ScrollSequence.tsx, a client component that
draws an image sequence to a single <canvas>.
Props: frameCount: number, path: (index: number) => string, and
progress: number (0 to 1) supplied by the parent.
Requirements:
- Preload all frames as HTMLImageElement and decode() them. Track how
many have loaded and expose it via an onProgress callback.
- Map progress to a frame index with Math.round, clamped to the range.
- Draw with "cover" fit: fill the canvas, crop the overflow, keep the
image centred. Write the cover maths as a small pure function.
- Size the canvas backing store to its CSS size times devicePixelRatio,
capped at 2. Resize with a ResizeObserver, not a window listener.
- Only redraw when the frame index or canvas size changes.
- If the target frame has not loaded yet, draw the nearest loaded one.
- canvas has aria-hidden="true".
Put frame paths and counts in lib/frames.ts. Add a temporary test page
at app/sequence-test/page.tsx with a range slider driving progress, so
I can check it without scroll. Run npx tsc --noEmit and fix any errors.Check after: drag the slider end to end on the test page. The image should never stretch, never flash blank, and stay sharp on a high-density screen. Resize the window and confirm the crop stays centred. The ideas behind each requirement are in canvas image sequence in Next.js.
2. Lenis and ScrollTrigger setup
Use this once the player works. It creates the smooth-scroll loop the rest of the site runs on.
Set up smooth scrolling with Lenis driven by GSAP.
- Create components/scroll/SmoothScroll.tsx, a client component that
wraps the app in app/layout.tsx.
- Use ReactLenis from 'lenis/react' with root and
options={{ autoRaf: false }}, and import 'lenis/dist/lenis.css'.
- Drive Lenis from gsap.ticker: add a callback that calls
lenis.raf(time * 1000), remove it on unmount, and call
gsap.ticker.lagSmoothing(0).
- Call ScrollTrigger.update on every Lenis scroll event.
- Register ScrollTrigger and useGSAP once, in a small lib/gsap.ts
module that every client component imports from.
- There must be exactly one animation loop. Do not add any other
requestAnimationFrame.
Explain in two sentences why autoRaf is false. Then run
npm run build and fix any errors.Check after: search the code for requestAnimationFrame; it should not appear outside Lenis itself. Scroll quickly and confirm nothing jitters. The pattern follows the Lenis README; the reasoning is in GSAP ScrollTrigger with Lenis in Next.js.
3. Wire scroll to the sequence
Connect ScrollSequence to scroll.
- Create components/scroll/StorySection.tsx. It renders a tall
section ([400]vh) with a sticky full-viewport container holding
the ScrollSequence canvas.
- Use useGSAP with a scope ref. Create one ScrollTrigger on the
section with start "top top", end "bottom bottom" and scrub: true.
In onUpdate, pass self.progress to the sequence.
- Do not use React state for progress on every scroll tick. Pass it
through a ref and have ScrollSequence read it inside a gsap.ticker
callback, so React does not re-render while scrolling.
- Replace the test page with this section on app/page.tsx.
Run npm run build. Then tell me how to change the scroll length.Check after: open React DevTools with "highlight updates" on and scroll. Nothing should re-render. The first and last frames should show exactly at the top and bottom of the section.
Story: chapters and text reveals
4. Pinned chapters with text reveals
Use this when the frames scrub correctly and you have your chapter copy written. Planning that copy is covered in how to plan a scroll story.
Add story chapters over the sequence.
Chapters (put them in lib/story.ts):
[1. "Headline", "one-line body", starts at 0.00, ends at 0.20]
[2. ...]
[3. ...]
- Each chapter is real DOM text layered above the canvas, not drawn
on it. Use an <h2> for the headline and <p> for the body.
- A chapter fades and rises in (opacity 0 to 1, y 24px to 0) as
progress enters its range, holds, then fades out before the next.
Drive all chapters from the existing ScrollTrigger's progress with
one GSAP timeline scrubbed by scroll; do not create a pin per
chapter.
- Text position comes from lib/story.ts: left, right or centre.
- Add a soft gradient scrim behind the text side only, so copy stays
readable over bright frames.
- Animate only transform and opacity.
Run npm run build and list the chapter timings you used.Check after: scroll slowly through each boundary. Two chapters should never be fully visible at once, and each headline should be readable against the frame behind it. Scroll backwards too; reveals must reverse cleanly.
Loading: frame tiers and phones
5. Frame tiers and progressive loading
Use this before you test on a slow connection. It assumes a light preview set and a full-quality set with the same numbering. To make those sets, see how to convert video to an image sequence with ffmpeg.
Add two frame tiers to ScrollSequence.
Tiers (define in lib/frames.ts):
- preview: /frames/desktop-preview/frame_NNNN.jpg (small, load first)
- full: /frames/desktop/frame_NNNN.jpg
Behaviour:
- Load the whole preview tier first, in order, with a concurrency
limit of [6]. The sequence is usable as soon as frame 1 is decoded.
- Then load full-quality frames outward from the current frame index:
nearest first, re-prioritising when the visitor scrolls.
- Draw the full frame when it is ready, else the preview frame.
- Keep at most [120] full-quality frames decoded. When over the limit,
release the ones furthest from the current index (drop the reference
and set src to an empty string).
- Abort pending full-quality loads that fall outside the window.
- Show a slim loading bar until the preview tier is complete.
Write the loading queue as a separate lib/frameLoader.ts with no
React in it. Run npx tsc --noEmit and npm run build.Check after: in browser DevTools, throttle the network to a slow profile and reload. The page should become scrollable once the first preview frames arrive, and the Network panel should show full frames loading around wherever you stop. Use the frame budget calculator to choose the window size.
6. Portrait frames on phones
Serve a separate portrait frame set on phones.
- Add a mobile and mobile-preview tier in lib/frames.ts pointing at
/frames/mobile/ and /frames/mobile-preview/ ([N] frames, 9:16).
- Choose the set on the client with
window.matchMedia('(max-aspect-ratio: 3/4)'). Never sniff the user
agent. Listen for changes and swap sets on rotation without
reloading the page, keeping the same progress.
- During server render and before the media query runs, render the
canvas container with a CSS background of the first preview frame
for the likely set, so there is no blank flash.
- Lower the decoded full-quality frame limit on the mobile set to
[60].
- Use 100svh rather than 100vh for the sticky container so mobile
browser bars do not cause jumps.
Run npm run build. Tell me how to test the swap in desktop DevTools.Check after: on a real phone, scroll the whole story and rotate the device mid-way. The subject should stay framed in both orientations and the page should not reload. More on why phones need their own frames is in scroll animation performance on mobile.
Reduced motion and accessibility
7. Reduced motion
Use this before any polish work, so every later change is tested against it. GSAP's gsap.matchMedia() docs show a reduceMotion condition built on (prefers-reduced-motion: reduce), and animations created inside it revert automatically when the query stops matching.
Add a reduced-motion mode.
- Use gsap.matchMedia() with conditions
{ reduceMotion: '(prefers-reduced-motion: reduce)' }. Create every
ScrollTrigger and timeline inside it.
- When reduceMotion is true:
- Do not start Lenis smooth scrolling; use native scroll.
- No scrub and no pinning. Each chapter becomes a normal section
with one still frame (the chapter's middle frame) as a static
image and its copy fully visible.
- Load only those still frames, not the sequence.
- Disable the three.js layer if present.
- Switching the OS setting while the page is open must work without a
reload.
Run npm run build. Then tell me exactly how to turn on reduced motion
in Chrome DevTools to test it.Check after: emulate reduced motion and confirm the page reads as a calm, complete story with all copy visible. Then switch it off and confirm the scrub returns. More detail is in reduced motion for scroll animation.
8. Accessibility pass
Do an accessibility review of the story page and fix what you find.
Check and report on each:
- Heading order: one <h1>, chapters as <h2>, no skipped levels.
- All copy is DOM text; the canvas and any WebGL layer have
aria-hidden="true".
- Text contrast against the scrim meets WCAG AA (4.5:1 for body,
3:1 for large text). Report the colours you checked.
- Keyboard: Tab reaches every link and button in order, focus is
visible, and Space/PageDown still scroll with Lenis active.
- Focus moving into a chapter scrolls it into view correctly.
- Nothing flashes more than three times per second.
- Links have descriptive text, images that carry meaning have alt.
List each issue with file and line before changing anything. Then fix
them and run npm run lint and npm run build.Check after: put the mouse away and use the page with the keyboard alone. Then run a screen reader over the first two chapters and listen for the headings in order.
Enhancement: a three.js light layer
9. three.js light layer
Use this only when the core story works. A light layer adds real-time depth over pre-rendered footage, the approach Orbitly takes. Whether you need it at all is discussed in image sequence vs video vs three.js.
Add a subtle real-time light layer above the sequence canvas.
- New client component components/three/LightLayer.tsx, loaded with
next/dynamic and ssr: false so three never runs on the server.
- A transparent WebGLRenderer (alpha: true) on its own canvas,
absolutely positioned over the sequence, pointer-events: none,
aria-hidden="true".
- Content: [soft drifting light particles / a slow volumetric glow]
in the brand accent colour read from the CSS variable --accent.
Keep it under [300] particles.
- Render from gsap.ticker, not a separate requestAnimationFrame. Tie
intensity to scroll progress so it peaks in chapter [2].
- Pixel ratio capped at 1.5. Pause rendering when the section is off
screen (IntersectionObserver) or the tab is hidden.
- Dispose geometry, materials and the renderer on unmount.
- Skip the layer entirely under reduced motion or if WebGL is not
available.
Run npm run build. Report the added bundle size for this route.Check after: the layer should be felt more than seen. Scroll on a mid-range phone and compare smoothness with the layer turned off. If it costs visible smoothness, reduce particles or drop it on mobile.
Quality: performance and polish
10. Performance pass
Do a performance review of the scroll story. Do not change anything
yet; report first.
Check:
- Work done inside scroll callbacks and ticker callbacks. Flag any
layout reads (getBoundingClientRect, offsetWidth, scrollHeight),
React state updates or allocations per frame.
- Whether drawImage runs when the frame index has not changed.
- How many decoded images can be in memory at once, worst case.
- Whether the first frame is in the initial HTML so Largest
Contentful Paint is not waiting on JavaScript.
- Fonts: preloaded, font-display set, no layout shift on swap.
- Client JavaScript per route after npm run build; what is largest.
- Any ScrollTrigger created outside useGSAP or gsap.matchMedia.
Give me a ranked list: issue, file, likely impact, proposed fix.Check after: pick fixes from the list in order of impact and apply them one at a time, re-testing in between. Then measure with Lighthouse in mobile mode. Which numbers matter for animated sites is covered in Core Web Vitals for animated websites.
11. Polish pass: typography and easing
Polish the story's typography and motion. Keep the structure.
Typography:
- Headlines: [typeface], fluid size with clamp() from [2.25rem] to
[5rem], tight leading (1.0 to 1.1), slight negative tracking.
- Body: max width 36ch, 1.5 leading, at least 16px on phones.
- Use text-wrap: balance on headlines.
Motion:
- Text reveals: ease "power3.out", 0.8 to 1.0 s feel; stagger
headline then body by 0.08 s.
- Exits faster than entrances.
- Scrub smoothing: scrub: [0.5] on the sequence for a slight
catch-up, scrub: true on text so it never lags the image.
- No easing on the frame index itself.
Colour: read all colours from CSS variables in globals.css; list any
hard-coded colours you find and replace them.
Run npm run build and summarise every value you changed.Check after: scroll the whole story at normal speed on a phone and a laptop. Headlines should never wrap to a single orphaned word, and text should feel attached to the image rather than floating behind it.
Ship: deploy configuration
12. Deploy config
Use this when the site is ready to go live. Next.js supports a Node.js server, Docker, static export and platform adapters, as listed in the Next.js deployment docs. A scroll story with no server features usually suits a static export.
Prepare the site for production as a static export.
- Set output: 'export' in next.config.ts. Check nothing in the app
needs a server (route handlers, server actions, dynamic rendering)
and list anything that blocks the export.
- Add metadata in app/layout.tsx: title, description, Open Graph
image (use a full-quality frame from chapter 1), canonical URL
[https://example.com].
- Write a hosting note in DEPLOY.md: frames under /frames/ must be
served with Cache-Control: public, max-age=31536000, immutable,
and HTML with a short cache. Include the exact config for
[Nginx / Netlify _headers / Cloudflare Pages _headers].
- If frame files may ever change, add a version folder to the frame
path in lib/frames.ts (e.g. /frames/v1/...) so caches can be
busted by changing one constant.
- Remove the sequence-test page and any console logging.
Run npm run build and confirm the out/ folder contains index.html
and the frames.Check after: serve the out/ folder locally with any static server and scroll the whole story once more, then check the response headers on a frame in DevTools after deploying. The full checklist is in how to deploy an animated Next.js site.
When a prompt goes wrong
Even specific prompts sometimes produce the wrong thing. A few habits keep that cheap:
- Stop it early. Press
Escas soon as Claude heads the wrong way. Context is kept, so you can redirect in the next message. - Rewind rather than argue. Press
Esctwice or run/rewindto restore an earlier checkpoint. The best practices page advises that after two failed corrections, a fresh session with a better prompt usually does better than a long one. - Feed it evidence. Paste the exact console error, or a screenshot of the broken frame, instead of describing it.
- Move repeated corrections into CLAUDE.md. If you correct the same thing twice, it belongs in the project rules.
If you would rather adapt a working engine than build one, the Motion templates come with the sequence player, scroll engine and loading tiers already built, and the same prompts work for changing them.
Questions, answered.
The questions people ask most about this topic.
01Can I paste all these prompts at once?
It is better not to. Each prompt builds on files from the previous one, and running them one at a time lets you test, commit and clear the context between steps. A bug in one layer is much harder to find when every layer was written in the same turn.
02Do these prompts work without a CLAUDE.md?
They will run, but results are less consistent. The prompts rely on rules like a single animation loop and frame paths defined in one file. Putting those rules in CLAUDE.md means Claude reads them at the start of every session instead of you repeating them.
03Which prompt should I run first?
The sequence player (prompt 1), tested with a slider before any scroll code exists. If the canvas drawing, cover fit and loading are correct in isolation, every later step is easier to debug.
04Do I need the three.js prompt?
No. Many scroll stories are pure image sequences. Add the light layer only when the core story works and you want real-time depth, and drop it on phones if it costs smoothness.
05Will these prompts work with plain React or another framework?
Most of the logic will. Change the framework details, such as next/dynamic, the App Router file paths and the static export, to match your setup. The canvas, GSAP, Lenis and reduced-motion requirements are framework-independent.
Keep reading
- Start here · the full workflowHow to Build a 3D Motion Website with ClaudeBuild a 3D motion website with Claude: plan the story, generate keyframes and video, cut frames with ffmpeg, then build it in Next.js with GSAP and Lenis.Read the guide
- Guide · WorkflowClaude Code Setup for 3D Scroll Websites, Step by StepSet up Claude Code for a 3D scroll website: install it, scaffold Next.js, add GSAP, Lenis and three.js, and write a CLAUDE.md to keep the build on track.Read the guide
- Guide · BuildCanvas image sequence scroll animation in Next.jsBuild an Apple-style canvas image sequence scroll animation in Next.js: frame preloading, cover-fit drawing, DPR sizing, GSAP scrub, portrait frames.Read the guide