All posts

three.js

I turned my 3D portfolio into one cinematic scroll

By Vivek Bhange5 min read

Cover image for I turned my 3D portfolio into one cinematic scroll

My portfolio has always had a 3D view. Until this week it was an island you flew around, which was fun for a minute and then got in the way: you had to hunt for the work. So I replaced it with Story, a portfolio you read by scrolling. Six short chapters tell the story so far, and behind them one particle world changes shape with each chapter.

You scroll, the words arrive, and the world behind them moves. Nothing to learn, nothing to steer.

The shape of it

  • Six chapters of plain HTML: Hello, Roots, Work, Build, Proof and Next. Every word is real text in the page, so search engines and screen readers get all of it, and the facts come from the same data files as the rest of the site.
  • One fixed canvas behind them: 15,000 glowing particles (8,000 on phones), drawn by three.js through React Three Fiber.
  • Six shapes, one per chapter: an ember for Hello, the Sahyadri ridges around Pune for Roots, a lattice for Work, three clusters for the three kinds of work in Build, a galaxy for Proof, and a single point of light for Next.

The colours stay in the site’s palette: warm white, with one particle in five amber, on black.

Morphing on the GPU

The obvious way to move 15,000 points between shapes is to update their positions in JavaScript every frame. That’s 45,000 numbers sent to the graphics card 60 times a second, and a mid-range phone feels it.

Instead, each particle carries all six of its positions from the start, as six attributes on the same geometry. The vertex shader blends between them. Per frame, the page only sends one number, how far through the story you are, plus the camera.

Two small touches make it feel alive rather than mechanical:

  1. Each particle starts its move a little later than the last. Every particle has a random seed, and the shader offsets its blend by it. A morph ripples through the cloud instead of snapping.
  2. The scene glides toward your scroll position instead of jumping to it. Fast flicks still land smoothly.

The camera has a viewpoint per chapter and eases between them. On wide screens the text sits on the left, so the scene leans right. On phones the text fills the width, so the camera steps back and the world sits low, under the words.

Making the words move too

A moving background with still text in front of it looks like a screensaver. I wanted every heading, card and number to take part, without adding JavaScript to the scroll.

So the text uses CSS scroll-driven animations. Each element gets a view() timeline, which runs an animation as the element crosses the screen:

  • Headings arrive one word at a time. Each word is wrapped in a span with its index, and that index shifts where its animation starts.
  • Timeline entries slide in, paragraphs come into focus from a blur, and the three Build cards tilt up from flat, like cards being stood on a table.
  • As a chapter leaves, its text eases away, and the first chapter pushes back into the distance when you start scrolling.

All of it sits inside prefers-reduced-motion: no-preference and an @supports check. A browser without scroll timelines just shows a normal, readable page.

Being kind to people and phones

  • Reduced motion means no scene at all. If your system asks for less motion, the canvas never mounts and Story reads as a calm long page.
  • A Pause motion button stops the ambient drift for anyone who finds it distracting.
  • Hidden tab, no rendering. When the tab isn’t visible, the scene stops drawing.
  • Slow device, fewer pixels. If the frame rate drops, the scene lowers its pixel ratio on its own.

Bugs that taught me something

  • “504 Outdated Optimize Dep.” The scene worked, then stopped loading mid-session in development. Vite discovered three.js only when the first 3D page opened, re-bundled it, and every page already open was left pointing at the old bundle. Listing the 3D libraries in optimizeDeps.include makes Vite bundle them at start-up. Rule I’m keeping: if a page loads big libraries lazily, pre-bundle them.
  • Links to a chapter snapped back. Opening /story/#ch-4 landed on the right chapter, then jumped somewhere else. Two things were fighting: the browser’s own smooth scrolling (from scroll-behavior: smooth in my CSS) and Lenis, the smooth-scroll library the site uses. On top of that, the browser jumped to the chapter before the fonts and images had settled, so it aimed at where the chapter used to be. Now native smooth scrolling is off while Lenis runs, and the page makes its jump through Lenis once everything has loaded.
  • The header vanished in light mode. Story is always night, but the header followed the visitor’s theme, and dark text on a black page disappears. The page now sets the night colours for the whole document (with html:has(.story)) and hides the theme toggle there.

The island didn’t go away

The old island is now a demo in my 3D lab, next to three newer pieces:

  • Hotel room tour: a real hotel room in 360, with hotspots, a morning, sunset and night light, and an availability check. The photo opens at 2K so the tour starts fast, then swaps to 4K on bigger screens.
  • Product configurator: a perfume bottle with real glass, five cap finishes and a live engraving. The design is kept in the link, so you can share exactly what you built.
  • Cinematic scroll story: the idea behind Story, as a launch page for a product.

Try it

Open Story and scroll slowly the first time. If you’d like something like it for your product or your own portfolio, tell me about it.

Enjoyed this?

Written by Vivek Bhange, Full-Stack AI Engineer. See his work or work with me.

Keep reading

Easter egg hunt

This site hides 16 surprises. Found ones stay found on this device. On a phone, type secret words into the command bar (the >_ button).

  1. RickrolledNot found yet

    Show hint

    My photo has a secret. Double-click it (on a phone, press and hold).

  2. Impatient clickerNot found yet

    Show hint

    Click anywhere, fast, about 25 times in a row.

  3. Agent of changeNot found yet

    Show hint

    Type the word that means "make it different".

  4. Gravity checkNot found yet

    Show hint

    Type my first name.

  5. Secret wordNot found yet

    Show hint

    Type something friendly, like "chai" or "namaste".

  6. HackerNot found yet

    Show hint

    Type what hackers do (four letters).

  7. The snapNot found yet

    Show hint

    Type the name of a purple villain who snaps.

  8. Sharp eyesNot found yet

    Show hint

    Something almost invisible floats on the screen. Find it and click it (desktop).

  9. Root accessNot found yet

    Show hint

    Open the command bar (press /, or tap >_ on a phone), then try to become root.

  10. Duck hunterNot found yet

    Show hint

    A rubber duck is hiding on the 3D island.

  11. World travellerNot found yet

    Show hint

    Visit all four views.

  12. Night owlNot found yet

    Show hint

    Come back between midnight and 4 a.m.

  13. Arcade regularNot found yet

    Show hint

    Play every quick game in the Arcade (the ones that open on the Arcade page).

  14. Chain reactorNot found yet

    Show hint

    Set off 30 bursts with a single move in Critical Mass.

  15. Last one standingNot found yet

    Show hint

    Win a match of Drop Zone.

  16. Code whizNot found yet

    Show hint

    Get 10 answers right in a row in Code Clash.

zsh — visitor@vivek: ~

Ask Vivek

Ask me anything. My work, how I run projects, or whether I'm a fit.

AI answers from this site's content. It can make mistakes.