From 68ea8576b6ed23d735f3e88866d474d694f71997 Mon Sep 17 00:00:00 2001 From: th Date: Mon, 20 Apr 2026 21:48:50 +0200 Subject: [PATCH] macro-clips slice 7: button state transitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ButtonClip transitions are now editable in ButtonInstanceDialog (from/to/duration/easing) and persisted on the clip via the new store.setButtonClipTransitions action; transitions are shared by every instance of the button (clip-scoped, not instance-scoped). - lerpProps exported from interpolate.ts so callers outside the sampler can blend two poses. - useButtonRuntime tracks an active transition per instance plus a reactive transitionTick that pokes Vue computeds each frame. A self-driving RAF loop runs only while some transition is active (idles when none), so animations work paused or playing. - applyButtonStateChange(id, to, transitions, persistedDisabled) is the one entry point for state changes — it looks up a matching from→to transition and starts it, or flips state instantly. Pointer handlers in CanvasStage and store.actionRuntime.setButtonState both go through it. - CanvasStage blends the two state stacks via sampleStateLayers + blendStates: layers matched by name interpolate their sampled props with lerpProps; unmatched layers fade in/out. Renderer uses the blended layer list in place of the pure state stack during transit. - Export runtime mirrors the same flow: applyButtonChange starts transitions, sampleButtonTransition drives per-frame progress, and drawButtonStatesBlended composites via drawLayer(layer, 0, override). drawLayer gained an optional propsOverride param for this. RUNTIME_VERSION bumped to 6. - Tests cover applyButtonStateChange matching logic and sampleTransition's time → u mapping plus done flag. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/ButtonInstanceDialog.vue | 154 +++++++++++++++++++++++- src/components/CanvasStage.vue | 94 +++++++++++++-- src/composables/useButtonRuntime.ts | 115 +++++++++++++++++- src/devtools/tests.ts | 40 +++++- src/i18n/messages.ts | 3 + src/lib/exportPlayer.ts | 119 ++++++++++++++++-- src/lib/interpolate.ts | 2 +- src/stores/scene.ts | 20 ++- 8 files changed, 515 insertions(+), 32 deletions(-) diff --git a/src/components/ButtonInstanceDialog.vue b/src/components/ButtonInstanceDialog.vue index 7e121ce..f261123 100644 --- a/src/components/ButtonInstanceDialog.vue +++ b/src/components/ButtonInstanceDialog.vue @@ -1,11 +1,11 @@