Skip to content

Falling Leaves

Autumn leaves swaying, tipping and turning over as they fall, in maple, oak and birch shapes. Loops perfectly.

Effect, V1 Effects2DSeamless loop, verified90 lines of codev1.0.0

In Nature & weather, Craft & heritage

Next: A Desert in an HourglassSurprise me

Falling Leaves preview
Starting live preview…
00:00:00:00 / 00:00:00:01

Live, running the real source.

Your current settings go with it. Combine several clips and hand them over together from your sequence.

Effect controls

Presets

60
0.5
8

The preview runs the same code your AI receives. These settings travel with the hand-off.

Info

What it is

Autumn leaves coming down the way real ones do: swaying side to side on a slow pendulum, tipping with each swing, turning over (a leaf seen edge-on thins to a line and shows its darker underside) and drifting a little on the wind. Each leaf is a smooth shape with a midrib and veins, in one of five maple, oak, birch, willow and rounded shapes, in reds, golds and browns (or spring greens). Every leaf falls a whole number of screen heights per loop and every sway and flip makes whole cycles, so the loop is exact. Choose the number of leaves, the colours, the wind, the sky colours and the seed.

Reuse it in your own idea

  • Autumn title: Autumn, warm.
  • Spring: Spring greens.
  • Harvest: Gold, many.

Which part is reusable

src/falling-leaves.js is the ingredient your AI reuses. demo.js is only the example scene around it, and uses the demo harness only for the demo.

Good to know

  • Leaves are flat shapes: they turn by squashing, not in true 3D.
  • They do not land: they leave the bottom and re-enter at the top.

Technical details

Technical details
Implementation
Canvas 2D — plain browser JavaScript, no libraries · ES module src/falling-leaves.js
Exports
  • createFallingLeaves({ leaves?, palette?, wind?, seed? }) => { draw(ctx, info, width, height) }
  • PALETTES: { autumn, spring, gold }
Dependencies (exact)
  • apw-runtime@1.0.0 (demo) — Demo harness. The reusable source has no dependencies.
How it fits a scene

Coordinates: Leaves are placed in fractions of the canvas; sizes scale with the smaller side; nearer leaves are larger and fall faster.

Lighting: A soft drop shadow lifts each leaf; the underside is darker.

Timing: Pure function of info.progress.

Output
1080×1080, 30 fps, 12 s · procedural (computed from the frame number) · seamless loop — Every leaf falls a whole number of screen heights per loop and its sway, flip and spin are whole cycles, so the last frame meets the first.
Tested
Rendered 360 frames on 2026-10-08 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (Canvas 2D). Same frame twice from fresh pages: identical. Loop: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.
Performance
Up to 200 small paths with shadows per frame; a few milliseconds. Shadows are the slowest part in software rendering.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- falling-leaves/1.0.0 --out my-video.mp4Needs Node 18+, ffmpeg and Chrome/Chromium. Add --params my-settings.json (from Copy settings) for your own settings.
Version
1.0.0 · sha256:e167c29a72699dcf…
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. License details
Provenance
Original code written for AI Pixel Wizard in October 2026, to the catalog quality bar (docs/QUALITY.md).
BinMore like this

Snowfall

Effect2DSeamless loop10 seconds

Hologram

3D object3DSeamless loop12 seconds

Snow Globe

3D object3DSeamless loop12 seconds