IS
Все эксперименты
в процессе· на языке оригинала: EN

Orbit Sandbox — toy gravity in your browser

Drop bodies, give them a flick, and watch n-body gravity pull them into orbits, slingshots and collisions. A tiny nod to Universe Sandbox.

лабораторная запись
Зачем делал

Universe Sandbox is my comfort software. I wanted to feel out how much of that 'poke the universe' joy survives in a 200-line canvas toy with naive gravity.

Что узнал

Naive O(n²) gravity is totally fine up to a few hundred bodies at 60fps. The hard part isn't the physics — it's a stable integrator. Plain Euler explodes; semi-implicit Euler stays calm.

Где сломалось

With plain Euler, two close bodies gain infinite energy and rocket off-screen. Softening the distance (adding an epsilon so r never hits zero) plus semi-implicit integration fixed the fireworks.

Стек
Canvas 2DTypeScriptrequestAnimationFrame

Poke the universe

Click empty space to drop a body. Click-drag to fling it with velocity. Everything attracts everything — so small clusters fall into orbits, and near-misses turn into slingshots.

живое демо
Демо загружается…

This one is marked wip on purpose: the integrator is stable but there's no collision merging yet, and I want to add mass-by-drag-radius next. That's the point of a lab note — showing the seams, not hiding them.

Orbit Sandbox — toy gravity in your browser — Lab