feat: 3D spatial/temporal IR core (opt-in core="ir") - #1
Merged
Merged
Conversation
… lint, and <sf-group> Insert a pure-data intermediate representation between the <sf-*> HTML surface and three.js, behind the unchanged window.__stereoframe seek protocol. A <sf-scene> opts in with core="ir"; the legacy render path is untouched. - IR core (packages/runtime/src/ir/): types/compile/evaluate are Node-safe and pure (no three.js/DOM). compile flattens a timeline algebra (seq/par/stagger/beat) into per-channel segments with bottom-up duration inference; evaluate(t) holds the active segment per channel + additive behaviors + a two-pass reference resolution (dynamic orbit/follow centers) -> FrameState. from-html/backend lower the DOM and apply it. - Hybrid coverage: IR owns turntable/float/sway/orbit/move/dolly/zoom/follow; the rest fall through to the legacy writers (compileAnimations skip set), byte-identical. - <sf-group>: compileScene's element loop is now recursive (addElement); a group builds a real THREE.Group so a verb on the group moves the whole subtree (three.js composes world matrices; the IR writes locals). - Render-free IR lint (cli): ir_dangling_ref / ir_zero_duration / ir_unreachable / ir_channel_conflict, from shared IR tables in vocab.ts; `schema` emits an `ir` block. Verified: bun test green; full example corpus renders byte-identical legacy<->IR (with one documented improvement: turntable+sway now compose additively instead of the legacy sway clobbering the spin); zero new lint false positives across examples. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extends the opt-in core="ir" pipeline (Surface -> IR -> evaluate(t) -> three.js)
with opacity/material channels and declarative named states, all lowered to the
existing per-channel held model.
- Entrances + material (B): FrameState gains opacity + material channels.
bounce-in (scale, entrance "hold from before window") + fade-in (opacity) +
variant (material chain via the held model; backend lerps colour with THREE.Color
for byte-identical parity) migrate from the legacy fallthrough into pure IR.
DOM-target fade-in stays legacy via a skip3d set.
- Named states (C): <sf-state name><sf-set target …/></sf-state> + <sf-scene initial>
+ <sf-animate verb="to" state>. The initial + each transition resolve into
per-channel tween (transform) + variant (material) segments (from = previous
state's value), resolved by the held model ("latest active state wins"). Adds one
pure `tween` driver; reuses the Phase-5 material appliers. IR-only (sf-state is
inert in legacy).
- Lint: ir_unknown_state, ir_state_requires_core. schema/vocab expose
sf-state/sf-set/to + the opacity/material channels and tween/fade-in/variant kinds.
Verified: bun test green; byte-identical legacy<->IR across the example corpus for
the migrated verbs; a state-toggle composition transitions move+rotate+recolour with
validate idempotency passing. No regressions.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Inserts a pure-data intermediate representation between
<sf-*>HTML and three.js,behind the unchanged
window.__stereoframeseek protocol. Opt-in per scene viacore="ir"; the legacy render path is untouched (no regressions).Highlights
ir/{types,compile,evaluate}(pure, no three.js/DOM).compileflattens a timeline algebra (seq/par/stagger/beat) into per-channelsegments with bottom-up duration;
evaluate(t)holds the active segment per channelbounce-in/fade-in/variant (entrance + material channels), and named-state
to.The long-tail (path/camera-path/explode/isolate/morph/crossfade-clip/deform +
DOM-target fades) falls through to the legacy writers, byte-identical.
<sf-group>— declarative hierarchy (three.js composes; a verb on the groupmoves the whole subtree).
<sf-state>/<sf-set>+<sf-animate verb="to">+initial,lowered to per-channel tween/material segments resolved by the held model.
ir_dangling_ref,ir_zero_duration,ir_unreachable,ir_channel_conflict,ir_unknown_state,ir_state_requires_core;schemaexposesthe IR vocabulary.
Verified
bun testgreen (195 incl. new IR compile/evaluate/lint tests).turntable+sway now compose; metaball is pre-existing GPU non-determinism —
validateidempotency passes). New
<sf-group>rig + state-toggle compositions verified.window.__stereoframecontract.🤖 Generated with Claude Code