Skip to content

Expose entered state names and animation durations - #7

Merged
jslauthor merged 1 commit into
mainfrom
feat/state-names-and-animation-durations
Jul 29, 2026
Merged

Expose entered state names and animation durations#7
jslauthor merged 1 commit into
mainfrom
feat/state-names-and-animation-durations

Conversation

@jslauthor

Copy link
Copy Markdown
Contributor

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

@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

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
jslauthor force-pushed the feat/state-names-and-animation-durations branch from ee1ea56 to 7079085 Compare July 29, 2026 16:53
@jslauthor
jslauthor merged commit b6320ef into main Jul 29, 2026
4 checks passed
@jslauthor
jslauthor deleted the feat/state-names-and-animation-durations branch July 29, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant