Afterglowscreensavers

Stars in a Gravitational Field Screensaver

Stars in a Gravitational Field is a free, in-browser physics screensaver where hundreds of points are pulled around invisible gravity wells, tracing orbits, slingshots and glowing spirals. Each star feels a real inverse-square pull toward the wells, so the motion is genuine n-body-style physics, not a canned animation. It runs full-screen with no download, and ESC exits.

Live preview

Press ESC to leave fullscreen. Settings are saved in your browser only.

How the Stars in a Gravitational Field screensaver works

The screensaver places one or more gravity wells on screen and fills the field with stars. On every frame each star sums the gravitational pull from every well using a real inverse-square law — the force grows as 1 divided by the square of the distance — then that acceleration updates the star's velocity, and the velocity updates its position. Closer stars get yanked hard; distant ones drift, exactly as gravity works.

Stars aren't dropped in at rest. Each one is spawned with a sideways, tangential velocity tuned to roughly orbital speed for its distance from the centre, so instead of falling straight in they sweep into curving orbits, ellipses and slingshot flybys. The Gravity strength control scales the pull, turning gentle wide orbits into tight, whipping spirals.

The wells themselves don't sit still. When you have more than one, they slowly circle the centre of the screen, so the gravitational landscape is constantly shifting and stars are handed off between wells in chaotic, never-repeating patterns. The Gravity wells control sets how many there are, from a single central attractor up to four.

With Motion trails on, the screen isn't fully cleared each frame — instead it's washed with a faint layer of the background color, so each star smears its recent path into a glowing streak that reveals the orbit lines. Stars that get flung far off-screen are recycled back in from the edge, so the field stays full forever.

A worked example

The defaults — 280 stars, Gravity strength 5, 2 gravity wells, Motion trails on, gold stars (#ffd27f) on near-black — give you two glowing wells orbiting the centre while streams of gold spiral between them. For a single hypnotic vortex, set Gravity wells to 1 so one well sits dead centre; for chaotic, churning slingshots, raise it to 4 and push Gravity strength toward 12.

Settings & tips

Frequently asked questions

Is the Gravity Stars screensaver free?
Yes. It runs free in your browser with no download or sign-up. Open the page, let it fill the screen, and press ESC to exit.
Is this real gravity physics?
Yes. Each star is pulled toward the gravity wells using a real inverse-square law, so the force grows as the distance shrinks. The orbits and slingshots emerge from that simulation.
What are the gravity wells?
They are the glowing points of attraction the stars orbit around. You can have between one and four, and when there are several they slowly circle the centre of the screen.
Why do the stars swirl instead of falling straight in?
Each star starts with a sideways velocity close to orbital speed for its distance, so gravity bends it into a curving orbit rather than a straight drop, producing spirals and flybys.
How do I get smoother orbit trails?
Turn on Motion trails. The screen is then only partly cleared each frame, so each star smears its recent path into a glowing streak that traces its orbit.

← All Generative screensavers