Expose entered state names and animation durations - #7
Merged
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Two read-only accessors a host needs to sequence and measure several timelines itself, both already present in the runtime and simply not surfaced. RiveStateMachine::stateChanged now carries the entered state's TIMELINE name instead of an empty string. A LayerState has no name of its own — StateMachineLayerComponent extends Core directly and the format has no name property for it — but an AnimationState knows the LinearAnimation it plays, and that name is what the editor shows on the state. States with no single timeline (entry / exit / any / blend) stay unnamed rather than inventing a label callers could come to depend on. The header's contract is updated, including a note that the first argument has always been the change index rather than a layer name: rive reports changes as a flat list across layers with no way to ask which layer each came from. RiveArtboard::animationDuration(name) / RiveView::animationDuration(name) report a clip's length in seconds WITHOUT instantiating it for playback. That's the point: a host driving a chain of timelines can weight them by real length before any of them has played, rather than discovering each duration only as it starts and lurching between equal-sized guesses. Misses and empty names return 0. Tests: every enumerated animation reports a positive duration and misses return 0; the state-machine spy asserts at least one emission is named and that every name matches an enumerated animation, which is the regression guard for the empty-string behaviour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jslauthor
force-pushed
the
feat/state-names-and-animation-durations
branch
from
July 29, 2026 16:53
ee1ea56 to
7079085
Compare
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.
Two read-only accessors a host needs to sequence and measure several timelines itself, both already present in the runtime and simply not surfaced.
RiveStateMachine::stateChanged now carries the entered state's TIMELINE name instead of an empty string. A LayerState has no name of its own — StateMachineLayerComponent extends Core directly and the format has no name property for it — but an AnimationState knows the LinearAnimation it plays, and that name is what the editor shows on the state. States with no single timeline (entry / exit / any / blend) stay unnamed rather than inventing a label callers could come to depend on. The header's contract is updated, including a note that the first argument has always been the change index rather than a layer name: rive reports changes as a flat list across layers with no way to ask which layer each came from. RiveArtboard::animationDuration(name) / RiveView::animationDuration(name) report a clip's length in seconds WITHOUT instantiating it for playback. That's the point: a host driving a chain of timelines can weight them by real length before any of them has played, rather than discovering each duration only as it starts and lurching between equal-sized guesses. Misses and empty names return 0.
Tests: every enumerated animation reports a positive duration and misses return 0; the state-machine spy asserts at least one emission is named and that every name matches an enumerated animation, which is the regression guard for the empty-string behaviour.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com