feat: canvas performance + cinematic upgrade#3
Merged
Conversation
7542860 to
b0fd24b
Compare
Precompute sin/cos of lat and lng at build time so per-frame projection of land dots, corona spikes and aurora samples is pure multiplies via the angle-sum identities. Tier-sort land dots with tierEnd ranges so each relief tier draws as one contiguous run. Cache the sun's cos/sin(lon) and rebuild night/core GeoJSON only when the sun moves, not per frame. Legacy geometry fields retained so the SVG build keeps working.
Track an EMA of raw frame time and nudge a dpr multiplier down (to 0.55 min) on sustained slow frames, back up with cooldown hysteresis; CSS size never changes. Add the intro ramp (0->1 over ~3.2s) with introPhase(a,b) for layers to read eased sub-windows, plus fling inertia so a flick glides and decays back into auto-rotation (works while paused).
Slower, longer-lived meteors and slower beam draw with longer dissolve. Calmer defaults: rotation 4 deg/s, activity 2.4/s, meteor frequency 40%.
Add the cinema schema section (intro, parallax, moon, heartbeat, comet, constellations, sunGlint, surges) and the new visual toggles (sunGlare, parallaxStars, nebula) so platform configs can drive them.
New canvas/draw.js (composite ops, glow sprites, blit, path-from-segments) and canvas/cinema.js with six layers: orbiting moon, rare comet, shimmering constellations, ocean sun glint, HQ heartbeat wave, and city surges.
Deeper offset-lit ocean, wider atmospheric rim with crisp shell line, sun glare under the sphere, low-res offscreen terminator, parallax starfield, nebula haze, 4-layer beams, twin impact rings, 3-pass aurora and warmer city lights. Register the new cinematic layers and read the engine's intro/parallax state in main.
Surface the new cinema and visual toggles in the scene panel with matching styles.
b0fd24b to
401fdb4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Orbit — performance + cinematic upgrade (Canvas build)
Brings the upstream perf + cinematic patch into main. Same architecture (shared core, thin renderers, schema-driven scene) and file layout. Canvas build only; the SVG build keeps working since the shared geometry retains its legacy fields. Root
index.html(the Canvas-vs-SVG chooser) is unchanged.Performance
sin/cosat build; per-frame projection is pure multiplies via angle-sum identities. Suncos/sin(lon)cached too.tierEndranges so each tier draws as one contiguous run (onefillStyle, no per-dot branching).BaseEnginetracks an EMA of frame time and nudges a dpr multiplier (down to 0.55) with cooldown hysteresis; CSS size never changes.Visual
Cinema
intro) — ~3.2s choreographed bloom on load; rotation eases in from stillness.parallax) — pointer eases a ±3.2° look offset added at projection time.moon), HQ heartbeat (heartbeat), rare comet (comet), constellations, ocean sun glint (sunGlint), city surges (surges).Interaction & defaults
Files
canvas/draw.js(shared canvas helpers),canvas/cinema.js(six cinematic layers).shared/{geometry,geo,engine,sim,scene-schema,config,ui.css,ui}.js,canvas/{layers,main}.js,CHANGELOG.md.Commits are split by theme and GPG-signed.