Feat/transitions#12
Open
anders130 wants to merge 10 commits into
Open
Conversation
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.
Summary
Phase 1 of the upgrade plan. Addresses the TV-mode workflow pain point: arbitrary per-call fade durations, a state-stack primitive for snapshot/restore, and per-layer opacity LiveParams that survive reloads. Also fixes a long-standing dark-band bug at zone soft-edges.
Why
crossfade_msand no way to snapshot/restore state, so "quickly dim part of the strip, then slowly fade back" wasn't expressible.blend_pixelwas dimming the overlay twice.What's new
TransitionSpec { duration_ms, curve }(domain) threaded through commands, runtime, and every scene/device route - every mutating endpoint accepts?fade_ms=...&curve=....TransitionEffectis effect-aware now (FrameIter blend instead of snapshot lerp), so the source effect keeps animating during the crossfade.POST /scenes/active/push,POST /scenes/active/pop?fade_ms=...,GET /scenes/active/stack,DELETE /scenes/active/stack) - LIFO snapshot of active layers + device state.Arc<LiveParam<f32>>and multiplied intoblend_pixel. The runtime keeps an id-keyed map so continuing layers reuse the same LiveParam across reloads.?fade_ms;PATCH /layers/{id}{"opacity": ...}retargets the existing LiveParam (smooth tween, no restart);DELETE /layers/{id}?fade_ms=...tweens to 0 then drops the row.blend_pixelrestructured to "fully blend, then lerp by opacity" - each blend mode now respects opacity uniformly.Breaking changes
0002_state_stack(new table) and0003_layer_opacity(new column, default 1.0). Existing rows back-fill to 1.0; no manual action needed.LayerResponseJSON gains anopacityfield - clients expecting a fixed shape may need an update.LayerSpec.opacity(internal) changed fromf32toArc<LiveParam<f32>>- only relevant if you have out-of-tree code building composites directly.crossfade_msinconfig/default.tomlis superseded by[transitions] default_fade_ms/default_curve. The old key is ignored (not removed yet).How to use the new things
Fade a brightness/color change:
Swap scenes with a crossfade:
TV-mode workflow (fast fade-out on a zone, slow fade-in on return):
Add a layer that ramps in over 3s:
Tween a layer's opacity:
Delete a layer with a fade-out:
(Returns 204 immediately; row stays in the DB with
opacity=0while it visually fades, gets dropped afterfade_ms.)Available curves:
linear,ease_in,ease_out,ease_in_out,exp.