Skip to content

feat(engine): wire stagger for container children#31

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/engine-stagger
Jul 18, 2026
Merged

feat(engine): wire stagger for container children#31
LeadcodeDev merged 1 commit into
mainfrom
feat/engine-stagger

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #20.

Goal: stagger on flex/grid/card/container applies index * stagger to each child's animations — the schema field existed (and was documented in the skill rules) but was wired to nothing.

  • New shared effective_effects() helper: style.animation + timeline steps (shifted by at) + accumulated stagger delay, with a zero-copy fast path when nothing merges
  • Stagger accumulates across nested containers; it also shifts start_at/end_at windows so hard-cut children stay in step with their staggered siblings
  • BuiltScene records per-node delays; the new LegacyPaintDispatcher::for_scene() consumes them so internal animations (draw_progress, char presets) shift exactly like the CSS overrides, and PaintCtx.stagger_offset is finally fed (was hardcoded 0.0)
  • Side effect: timeline steps now also reach internal animations through the legacy dispatch path (gap left by fix(engine): honor start_at/end_at visibility windows and wire timeline steps #27, which only covered CSS overrides)

Test: pixel regression — flex stagger: 0.2, three fading children at t=0.25: first fully lit, second partially faded, third with zero pixels. Written red first (it failed with all three fully lit). 139 total, all green.

Verify: cargo test --workspace ✓ · cargo fmt --check ✓ · clippy 0 warnings ✓

The stagger field on flex/grid/card/container was documented and parsed
but connected to nothing. Now:

- effective_effects() (shared helper) folds style.animation, timeline
  steps (at-shifted) and the accumulated container-stagger delay into
  one effect list, with a borrow fast path when nothing merges
- build_child threads index*stagger (cumulative across nesting) into
  the CSS override resolution, shifts start_at/end_at windows by the
  same amount, and records per-node delays in BuiltScene.stagger_delays
- LegacyPaintDispatcher::for_scene() carries those delays so internal
  animations (draw_progress, char_*) shift identically, and finally
  feeds PaintCtx.stagger_offset (was hardcoded 0.0); this also closes
  the gap where timeline steps never reached internal animations
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.

feat(engine): wire stagger for container children

1 participant