Visualizations
372 / 500

372 · Physics

Paper Glider

A notebook-paper glider that stalls, porpoises and circles in thermals for real.

The glider is flown by the textbook equations for airspeed, flight path angle, heading, angle of attack and pitch rate. Lift follows a straight lift slope that blends into flat-plate lift past about 14 degrees, so pulling too hard stalls the wing and the nose drops, while the slow phugoid porpoise falls out of trading height for speed. Thermals rise from sunlit fields as Gaussian updraft columns topped with cumulus, and the autopilot holds its speed, notices lift on the variometer, banks into a circle and centres it by turning less while flying toward stronger lift, then leaves at cloud base for the next one. The countryside is a perspective diorama of field bands receding to the horizon, the plane is a lit 3D mesh, and the trail shows each climb as a rising helix.

Try it. Drag up or down to pitch and sideways to bank, or use the arrow keys or WASD. Pull up too far and the wing stalls; circle in the shimmering columns to climb and see how far you can get. Let go and the autopilot takes over again. R relaunches.

  • Longitudinal flight dynamics
  • Lift and drag polars with stall
  • Thermal centring autopilot
  • Perspective-projected 3D mesh

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a side-view glider flight simulator with real aerodynamics, using JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Model the glider as a point mass in the vertical plane with airspeed V, flight path angle gamma, angle of attack alpha and pitch rate q. Use a mass of 1 kg, wing area 0.26 m^2, chord 0.3 m and air density 1.225.
- Lift coefficient: CL = 0.2 + 5 alpha while attached, blended with a sigmoid around alpha = 0.245 rad (about 14 degrees) into a flat-plate CL = 1.05 sin(2 alpha). Drag: CD = 0.028 + 0.042 CL^2, plus a big separated-flow term past the stall.
- Each step: L and D = 0.5 rho V^2 S C. V' = -D/m - g sin(gamma), gamma' = (L - m g cos(gamma)) / (m V). For pitch, a moment coefficient Cm = 0.08 + elevator - 0.8 alpha - 9 q c / (2V) drives q' = 0.5 rho V^2 S c Cm / I with I = 0.08, and alpha' = q - gamma'. Integrate with four small substeps per frame.
- Draw a pastel sky, a rolling ground line, and the glider as a little triangle rotated by gamma + alpha, with a fading trail.
- Let the mouse's vertical position set the elevator. Pull up too far and it should stall and drop its nose; trim it and it should porpoise gently (the phugoid).

Once it flies, make it beautiful and add soaring:
- Add thermals: columns where the air rises with a Gaussian profile, drawn as shimmering translucent columns with a cumulus cloud on top. Add their updraft to the glider's climb.
- Add a heading and a bank angle so the glider can circle, and an autopilot that circles when its variometer reads lift.
- Show a HUD with height, airspeed, climb rate and distance flown.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a perspective 3D paper plane, smarter thermal centring, or a procedurally generated cross-country landscape.
PreviousTensegrityStruts that never touch, floating in a web of cables, found by dynamic relaxation. NextViterbi TrellisA hidden Markov model catches a dealer swapping in a loaded die, roll by roll.

Related visualizations

  • Seed DispersalPhysics Samaras autorotate, dandelion seeds parachute and leaves flutter across a gusty meadow.
  • Gravity TurnPhysics A two-stage rocket flies pad to orbit on a live blueprint, max-Q and all.
  • Wind TunnelFluids A lattice Boltzmann wind tunnel: draw any shape and watch it shed vortices.
  • Sailing RegattaPhysics A watercolour yacht race where boats tack upwind because their polars say so.
  • Joukowski AirfoilFluids Exact flow past a wing, made by conformally mapping flow around a circle.
  • Moon LanderRetro Vector-line lunar descent on a green phosphor tube, with a suicide-burn autopilot.
  • Paper DragonMath Fold a paper strip in half seven times, open every crease to 90 degrees: a dragon.
  • Split-Flap BoardRetro A clattering departures board: every flap falls on a hinge, in perspective.
  • Kelvin-Helmholtz BillowsFluids A sunset sky where sliding air layers roll a cloud deck into breaking-wave billows.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs