WRITINGS

ZENKARISM // WRITINGS

A starfield in 2D canvas

How the hero of this site draws thousands of stars without WebGL.

The background you saw on the home page is a plain 2D canvas. No shaders, no libraries — just a loop, a few arrays and some care about what not to draw.

Depth from one number

Each star gets a depth value z. Size, brightness and parallax all derive from it, so near stars move more and shine brighter.

js
const x = wrap(s.x + px * s.z * 26, w);
const y = wrap(s.y - progress * s.z * 180, h);

Bright stars use a pre-rendered glow sprite instead of a gradient per frame. That single choice keeps the loop cheap on laptops.

Sample content — to be replaced.

DEMOThis site is in demo stage — the content you see is sample content and does not reflect reality.