👻 ✨ Henry’s Ghost Saga:
Twinkling Stars with Hue Drift
An extension of the original twinkling stars: all stars now slowly cycle through
the color wheel together. Three new ideas — float accumulator, loop scope rule,
and saturation floor — each small, each important.
Born from a Java offroading trip that found three bugs.
See the Chat Log for the full story.
Three New Ideas on Top of the Original Sketch
The original Twinkling Stars
sketch fixed the hue at yellow (60° on the HSB wheel). This version adds
a continuous hue drift: a globalHue float accumulator
advances 0.3° per frame, cycling all stars through the full color wheel together
every ∼40 seconds. Twinkling is still click-toggled independently.
Three small but significant changes make it work correctly:
-
Float accumulator:
globalHue += HUE_SPEED(fixed step) instead offrameCount × factor(grows over time). - Outside the loop: Hue advances once per frame, before the star loop. Inside the loop: every star gets a different hue that frame — a rainbow, not a drift.
- Saturation floor at 20: Stars with saturation near 0 are nearly gray; they can’t show a hue change. A floor of 20 ensures every star participates.
Live sketch requires a larger screen.
Try rotating to landscape.
Live Sketch
Stars drift slowly through the color wheel.
Click the canvas to toggle twinkling on/off.
What Changed from Twinkling Stars v1
Every concept from the original sketch carries over unchanged: HSB color mode, sinusoidal twinkling, phase offsets, the Processing lifecycle, named constants, and the click-to-toggle handler. Only three things are new:
- Removed:
var STAR_HUE = 60(fixed constant) - Added:
var HUE_SPEED = 0.3andvar globalHue = 60(float accumulator) - Changed: first line of
draw()now updatesglobalHueand computesstarHuebefore the star loop - Changed: saturation range from
random(0, 100)torandom(20, 100) - Inside the loop:
star.h = starHue— replaces the fixedstar.hset only insetup()
App Comparison (JS / Java / Python) • Chat Log — Java bugs & class design