Skip to content

GalaxyJS 3.3.0 "Deep Field" — a zero-dependency WebGL2 tier + 20 animations (60 → 80) - #5

Merged
Edwson merged 4 commits into
mainfrom
Edwson-patch-1
Jul 28, 2026
Merged

GalaxyJS 3.3.0 "Deep Field" — a zero-dependency WebGL2 tier + 20 animations (60 → 80)#5
Edwson merged 4 commits into
mainfrom
Edwson-patch-1

Conversation

@Edwson

@Edwson Edwson commented Jul 28, 2026

Copy link
Copy Markdown
Owner

A WebGL2 tier, still zero dependencies

Canvas 2D remains the default renderer and the fallback. registerAnimation now accepts renderer: "webgl2", and a new registerShader(name, { defaults, uniforms, fragment }) helper compiles a full-screen fragment shader and hands it the same lifecycle every 2D animation already gets:

  • DPR-clamped ResizeObserver sizing
  • pointer input as uMouse (xy in device pixels, y-up, z = inside)
  • IntersectionObserver suspension while off-screen
  • one still frame under prefers-reduced-motion
  • uniform declarations generated from the arity of the values passed in, so changing an option never recompiles

Geometry is a single full-screen triangle derived from gl_VertexID — no vertex buffer is allocated and nothing leaks. When a browser cannot supply a WebGL2 context, glPosterFallback paints a static 2D poster from the animation's own palette rather than leaving an empty canvas.

20 new animations (60 → 80)

Group Animations
Relativistic & gravitational lensing (Schwarzschild deflection + Einstein ring), accretionDisk (Doppler beaming + gravitational redshift), nBody, tidalStream, inspiral
Volumetric & raymarched (WebGL2) volumetricNebula (Beer–Lambert + Henyey–Greenstein), starSurface (granulation, limb darkening, prominences), atmosphere (Rayleigh + Mie), dustLanes (self-shadowed), protoplanetary
Instruments spectrograph, transitCurve, waterfall, hrDiagram, pulsarTiming
Pointer-driven & generative gravityWell, nebulaPaint, solarWind, starForge, relativisticJets

Changed

  • galaxy.d.ts declares all 80 names in AnimationType.
  • Expected counts in every test now derive from the generated manifest. test.mjs and test-mcp.mjs asserted the literal 60 in four places, which fails on every addition and trains you to bump the number instead of reading the failure. A >= 80 floor still catches accidental deletion.
  • New WebGL2 lifecycle contract in test.mjs: registerShader present, a WebGL2 context requested, a 2D fallback available, and an assertion that the library never force-loses a WebGL context — a canvas returns the same context object on every getContext, so losing it would poison any later mount on that canvas.
  • Demo gallery and index.html version/cache-bust strings updated; galaxy.min.js rebuilt (157.2 kB, 52.1 kB gzip).

Verification

Every one of the 20 was rendered in a real browser (headless Chromium) and inspected, not just compiled. A harness reported blank / blown-out / not-actually-animating per animation with pixel statistics and screenshots. Four real bugs were found and fixed that way — including solarWind, whose particles were launched upstream of a cull box that destroyed them on their first frame, so the scene silently froze.

node test.mjs and node test-mcp.mjs pass; the manifest regenerates with no drift.

@Edwson
Edwson merged commit 8018c1e into main Jul 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant