feat: animation groups for choreographing sequences across blocks#32
Merged
Conversation
Adds Animation.group / Animation.sequence / Animation.parallel plus an animate.group option on AnimationOptions. Multiple animated blocks can share a group; sequence() wires groups end-to-end so later blocks wait for earlier blocks' animations to complete. Runtime: each animation registers with its group synchronously (plain mutable counter, safe under JS single-threading) before forking. The forked fiber awaits the group's gate Deferred, runs the animation, and signals completion via Effect.ensuring so interruption still decrements. When a group's pending count returns to zero after having been non-zero, its done Deferred resolves, which cascades to open the next group's gate. Late registrations arriving after a group has finalized run immediately — matches the one-shot-intro use case. Closes #28 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Deploying effex-api with
|
| Latest commit: |
b650fd8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b3bbf1ea.effex-api.pages.dev |
| Branch Preview URL: | https://feat-animation-groups.effex-api.pages.dev |
Deploying effex with
|
| Latest commit: |
b650fd8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e66d93c3.effex.pages.dev |
| Branch Preview URL: | https://feat-animation-groups.effex.pages.dev |
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
Adds a declarative sequencing primitive for animations that span multiple animated blocks. Solves the "word-by-word intro" case where each word is its own
eachand word N should only start after word N-1's letter cascade finishes.API
New namespace
Animationon@effex/dom:Animation.group()— creates a group handle. Gate is closed initially, opens explicitly viasequence/parallel.Animation.sequence(count)— returnscountgroups wired end-to-end. Group 0's gate is open immediately; group N's gate opens when group N-1's animations all complete.Animation.parallel(count)— returnscountgroups with all gates open. Handy for concurrent segments (future: nest insidesequencefor mixed choreography).New option on
AnimationOptions:animate.group?: AnimationGroup— attach this animation to a group. The animation registers with the group synchronously, awaits the gate before starting, and signals completion when finished.Runtime
addSlotcalls in the same fiber before yielding to any forked animation fiber._awaitGatebeforerunEnterAnimationandEffect.ensuring(_complete)after (so interruption still decrements the counter).Effect.forkDaemonper link — daemons outlive the render scope and get GC'd with the group.Design notes
_complete's zero-crossing is guarded bydoneResolved, so subsequent register/complete cycles don't re-fire the done signal.Test plan
groups.test.tscovering gate/done semantics, sequence chaining, parallel behavior, late registration,_awaitGateblockingpnpm exec tsc --noEmitcleanDeferred to follow-ups
sequence(sequence(...), parallel(...))composition — current API takes a count, not a shapeoverlapoption onsequence(each group's gate opensnms before the prior finishes)Closes #28
🤖 Generated with Claude Code