[pull] main from motiondivision:main#208
Merged
Conversation
This implements #2205 - callbacks can now be injected at specific points in an animation sequence. Callbacks support both forward (onEnter) and backward (onLeave) firing for scrubbing support. Usage: ```js animate([ [element, { x: 100 }, { duration: 1 }], [{ onEnter: () => console.log("midpoint!") }, { at: 0.5 }], [element, { y: 200 }, { duration: 1 }], ]) ``` Implementation has minimal overhead: - SequenceCallbackAnimation is lightweight (no DOM ops, just time tracking) - Callbacks are sorted and stored separately from animations - Only fires callbacks when time crosses thresholds https://claude.ai/code/session_01Es5grCjnfwALQxsWvrrpzF
- Rename onEnter/onLeave to forward/backward for clarity - Remove dedicated SequenceCallbackAnimation class - Use animateSingleValue(0, 1) with onUpdate to track time crossings - Much simpler implementation with same functionality https://claude.ai/code/session_01Es5grCjnfwALQxsWvrrpzF
The WAAPI path should stay minimal and not pull in animateSingleValue. https://claude.ai/code/session_01Es5grCjnfwALQxsWvrrpzF
Just destructure animationDefinitions directly from createAnimationsFromSequence instead of wrapping it. https://claude.ai/code/session_01Es5grCjnfwALQxsWvrrpzF
Return ResolvedAnimationDefinitions directly instead of a wrapper object. Callbacks are passed via an optional out-parameter that only animateSequence uses. WAAPI path and tests are unaffected. https://claude.ai/code/session_01Es5grCjnfwALQxsWvrrpzF
onPanStart/onDragStart were deferred via frame.postRender(), causing them to fire after onPan/onDrag which ran synchronously in the update phase. Fix by using frame.update(callback, false, true) for all pan/drag event handlers. The third argument (immediate) schedules callbacks into the currently executing update step, so they fire within the same frame pass in the order they were scheduled: start before move. https://claude.ai/code/session_01NUF3Mj5SSALV5gSW6AVGn6
…, fix timing assertion - Rename forward/backward to enter/leave across types, create, and sequence - Add 4 integration tests: scrubbing thresholds, complete(), cancel() without scrub, cancel() after scrub - Fix unit test expectation for trailing keyframe offset in callback timing test https://claude.ai/code/session_01Es5grCjnfwALQxsWvrrpzF
…2056-da0kh Fix pan event firing order: ensure onPanStart fires before onPan
- Rename leave → exit across types, create, sequence, and tests - Replace fragile duration lookup with SequenceCallbackData out-parameter - Simplify isCallbackSegment type guard - Use optional chaining for callbackData in create.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reorder describe blocks so callback tests run before the buggy "non-animatable color" test that corrupts frame loop state. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ation-XwKRA Add sequence callback support for animation timelines
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )