JavaScript to WebAssembly examples

Open a demo to compare JavaScript and WebAssembly, inspect the source, and try it in the playground.

Black Hole
blackhole Schwarzschild geodesics, ray-traced — the far disk arcs over the shadow, brighter on the approaching limb
N-body
nbody three bodies in a chaotic dance tear each other’s star disks into tidal bridges and tails
three.js Math
threejs‑math three.js’s own Vector3/Matrix4/Frustum, unmodified — a camera culls a field of spheres against the view frustum; drag to steer
Boids
boids Reynolds flocking — cohesion, alignment, separation; the cursor is a hawk
Fireflies
fireflies Kuramoto oscillators — neighbour-coupled fireflies lock into traveling waves of synchrony
Swarm
swarm flies chase the cursor, every path kept as a long-exposure hairline
Dynamic Window
dwa a robot rolls out every reachable velocity and drives the arc that races to the goal while clearing drifting obstacles — local motion planning
Chladni
chladni two standing waves interfere into a plate nodal figure — drag to sweep the mode
Mandelbrot
mandelbrot escape-time fractal — perturbation theory carries the zoom past 10³⁰×
Julia
julia z² + c drawn by its distance estimate — a crisp white coastline in a soft glow; click any point to make it c
Buddhabrot
buddhabrot density of Mandelbrot escape orbits — a luminous nebula accumulates
Spectra
spectra eigenvalues of a stream of random 6×6 matrices — Bohemian lace melts into a spectral cloud
Burning Ship
burningship escape-time on |Re|,|Im| — a galleon ablaze below the Mandelbrot set
Newton Fractal
newton Newton's method on z³−1 — basins of attraction meet on a fractal edge
Lyapunov
lyapunov Markus–Lyapunov “zircon” — order in gold, chaos in dark
Domain Coloring
domain‑color an enhanced phase portrait — bands of log|f| cross sectors of arg f in a conformal checkerboard that shrinks into every zero and pole
Barnsley Fern
fern the chaos game on four affine maps grows a fern that sways
Particle Fluid
sph smoothed-particle liquid sloshing in a rocking tank — pairwise repulsion & viscosity, the classic O(N²) sum
Lattice-Boltzmann
lbm lattice-Boltzmann flow — a dye filament wraps into the von Kármán vortex street
Cloth
cloth Verlet cloth in 3D — a gathered satin curtain pleats at the rail; grab it, swing it, let the wind billow it
Waves
waves rain on black water — the 2D wave equation carries every ring, and each slope mirrors the studio lights
Ocean
ocean Tessendorf FFT ocean — a Phillips-spectrum sea synthesized by inverse FFT, moonlit
Double Pendulum
pendulum every pixel an initial angle, shaded by time-to-flip — click a pixel to fly that pendulum live
Magnetic Pendulum
magnet a damped bob over three magnets — each pixel shaded by which magnet wins; fractal basin boundaries
Newton's Cradle
cradle a chrome Newton's cradle — kinetic energy passes down the row; each ball mirrors its neighbours
Interference
interference Huygens diffraction — drag from two sources to an N-slit grating
Schrödinger
schrodinger quantum wavepackets diffract through a double slit, their wavefronts visible, fringes building up on a detector plate
Hydrogen Orbitals
hydrogen the electron clouds of the hydrogen atom — |ψₙₗₘ|² morphing s→p→d→f
Erosion
erosion hydraulic erosion — rain carves the terrain; flux pools into a river network
Plasma
plasma FBM domain-warp plasma laced with its own iso-lines — flowing silver silk
Lorenz
lorenz the butterfly that launched chaos theory — a strange attractor in 3D
Attractors
attractors de Jong map — millions of iters into luminous curves
Raymarcher
raymarcher a soft-shadowed SDF sphere field — Shadertoy on the CPU
Metaballs
metaballs liquid-metal blobs merge and split in the glow of their own field
Voronoi
voronoi brute-force nearest-site cells, drifting — white ribs with current flowing along them
Phyllotaxis
phyllotaxis lit florets at the golden angle pack a sunflower head — a hair off 137.5° breaks it
Harmonograph
harmonograph two damped pendulums trace precessing Lissajous figures
Plume
plume seven lines of trig unfold 40k points into sparkling feathers — tweet-sized generative art
Fourier Epicycles
epicycles a chain of rotating circles redraws a curve — the DFT made visible
Bifurcation
bifurcation the logistic map's period-doubling cascade into chaos
Times Tables
times‑table chords i→i·k mod N draw cardioids, nephroids and beyond
Apollonian Gasket
apollonian Descartes' circle theorem packs circles within circles, forever
Truchet Tiles
truchet two random arc tiles chain into an endless labyrinth — current runs its paths; tap to spark
Penrose Tiling
penrose golden-ratio deflation — aperiodic order with five-fold symmetry
Hyperbolic Tiling
hyperbolic a (2,p,q) triangle group tiles the Poincaré disk in the black and white of Escher's Circle Limit — drag to travel
L-Systems
lsystem string-rewriting grammars grow eight classics — Koch, the dragon, Hilbert, Gosper, and plants that taper trunk to twig
Ulam Spiral
ulam primes on a square spiral — diagonals of prime-rich quadratics
Pascal mod p
pascal‑sierpinski Pascal's triangle mod p — mod 2 is Sierpiński, primes remix it
Gaussian Primes
gauss‑primes primes of ℤ[i] in the plane — eightfold-symmetric constellations
Reaction–Diffusion
diffusion Gray–Scott coral & labyrinths — the growing fronts spark white
BZ Reaction
bz Barkley excitable medium — meandering spiral waves; drag to cut fronts into new spirals
Game of Life
game‑of‑life Conway's Life, straight into shared pixel memory
Falling Sand
sand falling-sand automaton — pour sand, water & walls
Sandpile
sandpile Bak–Tang–Wiesenfeld sandpile — avalanches self-organize grains into a fractal mandala
Lenia
lenia Orbium — continuous cellular life gliding through a smooth convolution field
Slime Mold
slime Physarum — two rival colonies contest territory with competing transport networks
DLA
dla diffusion-limited aggregation — click to race competing crystals for the walker supply
Maze
maze recursive-backtracker maze, then BFS solve — current runs through its walls; touch to spark
Wireworld
wireworld a 4-state CA streaming current through a tiled microchip — bus banks, fan-out trees, clock farms
Rule 30
rule30 Wolfram's elementary CA — one rule, endless aperiodic complexity
Ising Model
ising Metropolis spin flips — domains order & melt through Tc, M(t) charted live
Percolation
percolation occupy sites at probability p — the spanning cluster snaps in at p_c, P∞(p) charted live
Watercolor
watercolor ink on flowing water — a vortical fluid bath; drops bloom, strokes comb
Marbling
marble paper marbling — stacked drops push into concentric stones, combs draw them to swirls
Dithering
dithering David's lips from the real scan, a pyramid, a cube, a torus — one shadow-casting relief, seven 1-bit dithers
Raytrace
raytrace per-pixel ray tracing — soft shadows, a mirror sphere, and a refractive glass ball
Path Tracer
pathtracer path-traced Cornell box — soft shadows, glass, color bleeding; converges live from noise