Skip to content

feat(engine): CSS transitions (timeline style states)#42

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

feat(engine): CSS transitions (timeline style states)#42
LeadcodeDev merged 1 commit into
mainfrom
feat/engine-css-transitions

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #22.

Goal: state-based animation without keyframe boilerplate — "turns blue at 2s", "dims to 20% at 3s".

  • TimelineStep gains style: CssStyle states applied from at onwards; box-model properties (layout, background, border, opacity, transform, filter) snap via a schema-complete serialize-merge (nulls and empty animation arrays never erase values)
  • style.transition (0.5 or {"duration": 0.5, "easing": "ease_in_out"}) smooths the supported set by compiling state changes into synthesized Keyframes effects — no new engine path:
    • opacity as ratios of the base opacity (apply_animated_props multiplies, so non-1.0 bases land exactly)
    • color on text/counter via AnimatedProperties.color — which the animator wrote but no painter consumed (same phantom class as fix(css): reconcile phantom properties (backdrop-filter, overflow-wrap, text-shadow typing) #12); now wired into Text and Counter. Color states use this path even without a transition (1ms ramp = visual hard cut) because painters read their own style, not the merged node css — documented.
  • effective_effects now takes the component and folds animation + timeline + synthesized keyframes + stagger in one place for both the css-override and painter-props paths
  • Bonus fix: KeyframesConfig.delay was silently ignored by the resolver, so timeline/stagger shifts on keyframes effects did nothing — keyframe times now shift by the delay (red-first regression test)

Tests: 4 new pixel tests (snap, linear smooth midpoint, red→blue blend on text, keyframes-delay). 217 total, all green. Skill rule updated with the state-change syntax.

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

Timeline steps gain an optional style state applying from their at
onwards (box-model properties snap: layout, background, border,
opacity, transform, filter). A new style.transition config (bare
duration or {duration, easing}) smooths the supported set:

- opacity: synthesized as ratio keyframes against the base opacity
  (apply_animated_props multiplies), so non-1.0 bases land exactly
- color on text/counter: absolute color keyframes driving the newly
  wired AnimatedProperties.color (it was written by the animator but
  consumed by no painter); color states flow through this path even
  without a transition (1ms ramp = hard cut) since painters read
  their own style, not the merged node css

effective_effects now takes the component and folds animation +
timeline + synthesized transition keyframes + stagger in one place
for both the css-override and painter-props paths.

Also fixes KeyframesConfig.delay being silently ignored by the
resolver — timeline/stagger shifts on keyframes effects did nothing
(gap left by the start_at/timeline rework).
@LeadcodeDev
LeadcodeDev merged commit 3e2c876 into main Jul 18, 2026
@LeadcodeDev
LeadcodeDev deleted the feat/engine-css-transitions branch July 18, 2026 22:07
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): CSS transitions (state-based animation)

1 participant