Sand AISand AI MAGI-2MAGI-2 est maintenant sur SandBase : vidéo 1080p avec audio natifEssayer maintenant

Sandpile Folio

A square sand tray printed like a field plate, where any cell holding four grains tips one grain to each neighbour, so pours, spouts and handfuls grow fractal medallions and rain mode plots every avalanche on log-log axes.

Exemple

Sandpile Folio sand tray
Ouvrir dans un nouvel onglet

Sandpile Folio sand tray

L’exemple s’exécute dans un cadre sandbox sans accès à cette page.

Exécuter en ligne

Exécutez-le dans un sandbox SandBase et consultez vos résultats dans Lab.

Ouvrir dans Lab ↗

Ce que vous obtenez

Bring where to pour the sand and which of the three modes to run. The Skill returns a downloadable Skill and a runnable sandpile scene.

Fonctionnement

  1. 01

    Build the bilingual sand tray

    Sandpile Folio needs only npm install, which brings in playwright-core for the checks, then npm run build for one bilingual dist/index.html or npm run build:zh for a Chinese-only page from the tray-zh brief. The tray, chips, census and plot are Canvas 2D code with no image assets and no network requests, so the page opens offline in a browser.

  2. 02

    Topple grains across the grid

    The tray is an Int32Array of grain counts on an odd N by N grid, 239 cells across at desktop sizes, inside a one-cell sink border where grains fall off. Each pass visits only queued cells: any cell holding four or more grains sends one to each neighbour and queues those that become unstable. The speed chip sets 1 to unbounded passes per frame, so large avalanches spread visibly.

  3. 03

    Pour, rain and check the tray

    Open dist/index.html, or add ?lang=zh-CN for Chinese, then drag to pour, press Space to plant a spout, or switch to Rain to record slide sizes on log-log axes with a fitted slope. Time is injected and randomness seeded, and ?seed= picks another run. npm run shoot checks in headless Chrome, with the network blocked, that pours topple, rain measures slides, the identity settles and clearing empties the tray.

FAQ

What is the Abelian sandpile in Sandpile Folio?

The Abelian sandpile is a cellular automaton with one rule: any cell holding four grains topples and sends one grain to each of its four neighbours. Sandpile Folio runs that rule on a square tray, 239 cells across at desktop sizes, inside a sink border that loses grains over the edge. Pours, spout drips and handfuls settle into the fractal medallions the page draws, with one colour per grain count.

Does Sandpile Folio need an API key?

No. Sandpile Folio runs offline in your browser and calls no model, so it needs no API key and nothing is billed. Every cell, chip and plot is drawn by Canvas 2D code in one HTML file with no image assets and no network requests. The npm install step only fetches playwright-core for the headless checks; the page itself has no runtime dependency.

What do the Pour, Identity and Rain modes in Sandpile Folio do?

Pour, Identity and Rain are the three Sandpile Folio modes, and they share one grid. Pour lays a stream of grains under the pointer, spouts drip at fixed cells, and the 4-way chip mirrors every pour across both axes. Identity puts six grains on every cell, stabilises, subtracts the result from six and stabilises again, leaving the identity element of the sandpile group. Rain re-lays a sparse or busy tray at about 2.1 grains per cell, then drops single grains at random.

Why does Sandpile Folio measure slide sizes only in rain mode?

Sandpile Folio records slide sizes only in rain mode because a dripping spout never lets the tray settle, while single grains falling one at a time give each slide a clear start and end. A slide's size is its number of topplings. Sizes go into powers-of-two bins drawn as slides per unit size on log-log axes, and a least-squares line through bins with at least four slides gives the printed slope.

Can I control Sandpile Folio from the keyboard?

Yes. Sandpile Folio moves a cursor with the arrow keys; Space or Enter plants or removes a spout under it, and Shift+Enter drops ten thousand grains at that cell. With a pointer, press and drag to pour and double-click to drop ten thousand grains. The chips set the mode, the toppling passes per frame and the 4-way mirror, and also clear the tray, drop 10k and save a PNG.

What are the limits of Sandpile Folio?

Sandpile Folio draws one pixel per cell and scales it up without smoothing, so the grid size is fixed when the page loads and resizing the window rescales the same tray. Pour-mode activity never fully settles while a spout drips, which is why slide sizes come only from rain. The identity mode takes a while at low pass counts, so raise the speed chip to watch it resolve.

Does Sandpile Folio respect reduced motion?

Yes. When the system asks for reduced motion, Sandpile Folio stops unattended grains, meaning the spout drips and the random rain, once the opening medallion has formed. Your own pours, handfuls and chip actions still work, so you can keep building patterns by hand. The page reads ?lang=en, the default, or ?lang=zh-CN to choose the language of its copy.

Skill Lab · Interactive scenes

Resin Diorama

Live 3D resin-block dioramas in your browser: send a little tram across a clear turquoise sea, or ripple the bay of a cliff island. Synthesized sound, and every scene can be tuned.

Skill Lab · Interactive scenes

3D Vehicle Worlds

Explore interactive 3D vehicle worlds in your browser, with varied terrain, camera controls and driving effects. Choose a playable example to begin.

Skill Lab · Interactive scenes

3D Firefly Terrariums

Turn a thick glass miniature, scatter glowing fireflies and open its brass lid. Actual particles leave through the neck and return before it seals. A moonlit cabin, forest and real local lights in one offline HTML.

Skill Lab · Interactive scenes

Jelly Candy: Fruit Bears

Six translucent fruit gummies on a white table. Grab any part and pull, lift a head until the neck stretches thin, press one flat until it springs back, flick one across the pile or pour in more. Fixed-step soft-body physics and a marching-cubes skin in one offline HTML.

Skill Lab · Interactive scenes

WebGPU Soft-Body Gummy Bears

Four translucent gummy bears on an ivory floor, rendered with native WebGPU. A deterministic 36-second choreography stretches, presses, flips and tumbles them before they settle back to the exact rest pose. Drag any bear to stretch, squish or toss it. A fixed-step tetrahedral XPBD solver in one offline HTML.

Skill Lab · Interactive scenes

Stone Stars: 3D Miniature Landmark City

Turn a city into a storybook 3D island around one landmark, with chapters, a daylight-to-starlight slider, street life and a matching scored 24-second film. Sample: a Gaudí-style basilica.