Starfield drift
SubscriptionStars falling toward the viewer on a perspective divide, recycled at the far plane.
Two hundred and sixty points hold a position in a unit cube and are divided by their own depth to project, so a star near the camera moves further across the frame per tick than a distant one and the field reads as travel rather than drift. Depth decrements at a fixed rate; a star that reaches the near plane is reseeded at random on the far one, which keeps the density constant without a spawn queue. Radius and alpha are both taken from the same depth term, so a star brightens as it grows. The frame is cleared with a translucent ground rather than wiped, leaving each point a short tail.
This is part of a CreativePower subscription. Subscribe to see its code and use it in your pages.
See plans