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