Lab

Gravitron.

A solar system in your browser. Tap or click to add a planet, drag to fling it. Turn on long exposure and every orbit stays in the picture, or go zen and let it fill the screen.

Original on CodePen (opens in a new tab)

How it’s built

Every planet pulls on every other planet, sixty times a second, on a plain Canvas 2D. The trails live on a second canvas that never gets wiped completely.

Tech
Canvas 2D · requestAnimationFrame · n-body gravity · Pointer Events · Web Share
Source
566 lines · 23.4 kB