199

Pinwheel Scenes

£7
or the whole Vault, £99

A pinned full-screen sequence of photographs and videos where a spirograph rosette opens from a pinhole in each scene, its picture split into counter-rotating rosette rings, and zooms you through to the next, scrubbed by the scroll wheel in both directions.

ScrollTrigger Lenis advanced
9 more details
pinningscrubcanvaszoommask-revealvelocity-reactivevideo-playbacklenisprogressive-enhancement

Released

About this effect

A full-viewport sequence of photographs and videos that changes scene through a spirograph. As you scroll, a pinhole appears in the picture on screen at a focus point and grows into a scalloped rosette that turns through about 200 degrees as it opens. Around it, the picture sits in three nested rosette rings that counter-rotate like spirograph gears, each carrying its own part of the scene, and the growing hole swallows them one by one. The outgoing picture zooms towards you as it unwinds, so you fly through into the next scene, which settles from a slight zoom of its own.

Read the full effect overview

The scroll drives every step, so the rosette winds open and closed again as you scroll back and forth. A gentle scroll gives a smooth, even turn; a fast flick adds spin to the hole and the rings, and they settle back. Every scene names the point the rosette opens from, so it can open on a dome, a tree or a face rather than the middle of the frame. The frame's own edges only ever zoom, so they never break or repeat.

Videos work as well as photographs: the outgoing film keeps playing in the rings and around the hole, drawn from the one playing video on every frame. The demo is a five-scene series of two films and three photographs, with a caption and a counter for each.

Pinwheel Scenes - GSAP animation effect preview

What's included

12 items
  • A spirograph rosette opens in the outgoing scene: it starts as a pinhole at the focus point and grows until it clears the frame, turning through about 200 degrees as it opens
  • Up to three nested rosette rings around the hole counter-rotate like spirograph gears, each carrying its own part of the picture, and the hole swallows them one by one
  • 3 to 16 rounded lobes (10 by default, 8 on phones) with data-pinwheel-lobes, lobe depth from circle to deep scallops with data-pinwheel-curve, and 0 to 3 rings with data-pinwheel-rings
  • The outgoing picture zooms towards the viewer around the focus, so you fly through; the outermost region never rotates, and the rings stay inside the area the zoomed picture always covers, so the frame edges never break or repeat
  • The incoming scene, seen through the hole, settles from 1.25 to 1 about its focus point
  • Scrubbed by the scroll in both directions: scroll back and the rosette winds closed to a pinhole again
  • Scroll speed adds spin: a flick turns the hole and the rings further and widens the hole slightly before they settle; data-pinwheel-velocity sets the strength, and 0 turns it off
  • Cut-paper finish: a faint shadow under each ring's edge and inside the hole, at most 5% and gone by halfway through each change, plus a 1px pen line on the hole edge while it is small (data-pinwheel-trace="off" removes it)
  • Per-scene focus point with data-pinwheel-focus="x% y%", so each rosette opens on its subject
  • Live video: the canvas redraws the outgoing film every frame in every ring, so it keeps moving as it unwinds
  • Videos play muted and inline only while their scene is on screen, load one change ahead once the page has loaded, and show their poster until the first frame arrives
  • Optional caption fades and a counter (02 / 05) that follow the scroll, a pinwheel:change event, devicePixelRatio and resize handling, and stacked full-bleed frames with posters for no-JS, blocked-CDN and reduced-motion visitors; revert() restores the markup

Perfect for

5 use cases
  • Photography portfolios and photo essays told one full-screen frame at a time
  • Architecture and interiors studios moving between projects
  • Product launches that alternate stills and short loops
  • Travel and editorial features with a chaptered, cinematic scroll
  • Agency and studio sites that want a bold scene change without a slider

How it works

2 sections

The container is pinned for one viewport, and each scene change takes one screen of scroll by default. While a change is under way, the outgoing scene's image or video element is hidden and its pixels are drawn onto a single 2D canvas laid over the incoming scene, in layers. The outermost region is the picture zoomed about the focus point and never rotated. Each ring is a rosette, r = base × (1 + b cos kθ + c cos 2kθ), painted inside the one outside it, with the same zoomed picture rotated by its own angle; neighbouring rings turn in opposite directions at different speeds. The rings stay inside the circle the zoomed picture always covers, so a turning ring never shows a corner of the picture. Last, the hole, a rosette of the same family that turns and grows from a pinhole, is cut out with destination-out, swallowing the rings in turn until it has passed the farthest corner.

The progress is scrubbed, so reversing the scroll reverses everything exactly. A short spring adds the scroll's velocity to the turn of the hole and the rings and settles back to the scrubbed position. The incoming scene sits underneath as ordinary markup, scaling from 1.25 to 1 about its focus point. Captions fade out and in from the same progress. Without JavaScript, under reduced motion, or if GSAP fails to load, the scenes stay in the document as stacked full-bleed frames.

Plugins ScrollTrigger
Difficulty Advanced
Smooth scroll Lenis integration
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Lighthouse, as measured

Google Lighthouse on this effect's demo, from the latest scan. A measurement of the demo as shipped, not a promise for your page.

Accessibility
100
Best practices
100

No performance score, on purpose. That figure depends on how you deploy: your server's compression and caching, your CDN, the connection and the device doing the test, none of which the code controls. The same page can score very differently on two consecutive runs, so measure it where it will live.

The Vault opens this source and the whole library.

Each product gives you the HTML, CSS and JavaScript source, the full documentation and an AI setup prompt, licensed for unlimited personal and commercial projects. Every paid product is tested for desktop and mobile layouts, reduced-motion handling, animation cleanup and keyboard controls wherever there is something to operate.

One payment, over 350 products, and future additions to the library.

Documentation

Quick Start

1. Add to your HTML <head>:

In your downloadThe working code for this step, in index.html.

2. Add the sequence anywhere in your <body>. Each scene wraps one img, picture or video; captions are optional.

In your downloadThe working code for this step, in index.html.

3. Add before the closing </body> tag:

In your downloadThe working code for this step, in index.html.

The sequence pins when its top reaches the top of the viewport. Put it first on the page to open straight on the first scene, or anywhere further down.

Using It With Your Own Design

What the effect needs from your markup: a container with data-pinwheel-scenes, and at least two descendants with data-pinwheel-scene, each containing one img (inside a picture if you like) or video. The script reads data attributes only, never class names. Inside a scene, a figcaption (or any element with data-pinwheel-caption) is faded out and in with the scene change. Inside the container, [data-pinwheel-counter] receives the text 02 / 05 and [data-pinwheel-cue] fades out on the first scroll. Both are optional. A scene's media must be same-origin or served with CORS headers, because the outgoing scene is drawn to a canvas.

What is only the demo's styling: everything outside the block marked EFFECT CONTRACT in style.css. That covers the Mona Sans type, the caption layout, the title bar, the scrims behind the captions, the scroll cue and the colophon. Restyle or delete any of it. The scenes can be any element (figure, div, article), and the captions any layout.

CSS the effect depends on: the EFFECT CONTRACT block. It does two jobs:

  • Without JavaScript, the container is a stack of full-viewport frames (height: 100svh, media object-fit: cover). This layout is also what reduced-motion visitors see, and what you see if GSAP fails to load.
  • While the sequence runs, the script sets data-pinwheel-live on the container. The contract then makes the container one viewport high with overflow: hidden, stacks every scene absolutely inside it, and puts the generated canvas[data-pinwheel-canvas] at z-index: 2. Anything you want above the outgoing picture, such as captions or a counter, needs z-index: 3 or higher.

Use object-fit: cover on scene media. The canvas reproduces the cover crop and reads each element's object-position, so a crop you art-direct in CSS carries over onto the canvas. Do not put opacity, filter or transform on the scene elements themselves: the script scales the media inside them, and those properties would put each scene in its own stacking context, under the canvas.

Options

Container attributes:

Attribute Values Default Description
data-pinwheel-lobes 3 to 16 10 Number of rounded lobes on the rosette. Phones are capped at mobileLobes (8).
data-pinwheel-rings 0 to 3 3 Counter-rotating rosette rings around the hole. 0 gives a plain rosette hole.
data-pinwheel-curve 0 to 1 0.55 Depth of the lobes: 0 is a circle, 1 the deepest scallops.
data-pinwheel-velocity 0 or more 1 How much scroll speed adds spin to the hole and rings and widens the hole. 0 turns it off. Touch screens get about half.
data-pinwheel-scroll 20 or more 100 Scroll distance for each scene change, as a percentage of the viewport height.
data-pinwheel-shadow 0 to 1, off 1 Strength of the faint cut-paper shadows under each ring's edge and inside the hole. At most 5%, and gone by halfway through each change.
data-pinwheel-trace off on Set to off to remove the 1px pen line on the hole's edge.

Scene attribute:

Attribute Values Default Description
data-pinwheel-focus "x% y%", or keywords such as center top 50% 50% Where the rosette onto this scene opens, and the point both scenes zoom and turn about.

Global options go in PinwheelScenes.init({...}) or in window.PinwheelScenesOptions, defined before the script loads. Data attributes win over them.

Option Default Description
hold 0.2 Share of each change during which a scene rests, split between its two ends.
scrub 0.4 ScrollTrigger scrub smoothing in seconds; true follows the scroll exactly.
startScale 1.25 Scale the incoming scene starts from, inside the hole.
zoom 1.5 Scale the outgoing picture reaches as the hole clears the frame.
turn 3.6 Radians the hole turns over one change (about 205 degrees); the rings turn at fixed fractions of it in alternating directions.
maxTorque 0.11 Flick strength: the hole turns up to four times this in radians, the rings by smaller amounts, and the hole widens slightly.
mobileLobes 8 Lobe cap below mobileQuery.
mobileQuery '(max-width: 767px)' Media query for small screens.
maxPixels 4200000 Cap on the canvas backing store, applied after the devicePixelRatio cap of 2.
smooth true Create a Lenis instance when Lenis is loaded and the page has none.
lobes, rings, velocity, scroll, shadow, curve, trace as above Defaults for the matching data attributes.

Video

Use muted loop playsinline and preload="none", with a poster. Once the page has loaded, a video scene starts loading when the sequence is one change away from it. It plays only while its scene is on screen, whether resting, seen through the hole or unwinding around it, and pauses otherwise. While it is the outgoing scene, the canvas redraws its current frame into every ring on each tick. Until the first frame has decoded, the canvas shows the poster. Under reduced motion and without JavaScript, videos never play and the poster shows.

Keep clips short and small. The demo's two loops are 1.7 MB and 3.4 MB.

Accessibility

  • Reduced motion: nothing is pinned or drawn, and the scenes stay as stacked full-bleed frames with their posters. A preference change while the page is open rebuilds the layout and keeps the visitor on the same scene.
  • No JavaScript or blocked CDN: the same stacked frames. The pinned layout exists only while the script has marked the container data-pinwheel-live.
  • Screen readers: scenes stay in document order, with their own alt text, aria-label and captions. The canvas and the counter are aria-hidden.
  • Keyboard: the sequence is driven by page scrolling, so Page Down, Space and the arrow keys step through it.
  • Touch: the same mechanic under native touch scrolling, with eight lobes and half-strength flick spin.

Dependencies

Required:

  • GSAP 3.12+ (the demo is pinned to 3.15.0)
  • ScrollTrigger

Optional:

  • Lenis 1.x (the demo uses 1.3.17). Smooth scrolling follows ?smooth=off|on in the URL, then data-smooth="off" on <html>, and is never created under reduced motion.

Demo media

The photographs are graded derivatives of Pexels and Unsplash photos (assets/img-manifest.json lists the sources). The films are an aerial surf loop from Pexels and a city towers loop from Mixkit, used under their free licences (assets/video-manifest.json). Replace them with media licensed for your project before you publish.

Also in your download: the full source, worked examples, the events and programmatic API, and the class reference.

£7