Skip to content

fix: cross-animation state machine transitions#513

Merged
theashraf merged 10 commits into
mainfrom
fix/cross-animation-marker-ordering
Apr 1, 2026
Merged

fix: cross-animation state machine transitions#513
theashraf merged 10 commits into
mainfrom
fix/cross-animation-marker-ordering

Conversation

@theashraf

@theashraf theashraf commented Mar 31, 2026

Copy link
Copy Markdown
Member

Summary

Fixes cross-animation state machine transitions where returning to a previous animation (e.g., Second Scene → Main Scene) would cause the animation to stop rendering.

  • Reset stale theme on animation switch: load_animation() re-applies the saved theme after loading, but themes are animation-specific. Stale slot values from the old animation caused flush_slots() to fail, silently breaking render() and preventing OnComplete from ever firing.
  • Skip tweened transitions across animations: Tweening interpolates between markers within one animation's timeline. Cross-animation tweens would tween in the old animation then abruptly switch, producing a visual glitch. Now falls through to instant transition.
  • Correct state entry ordering: Load animation before setting marker/mode/autoplay so markers resolve against the new animation's data.

When transitioning between animations in the state machine, the marker
was being set before the new animation was loaded, causing it to resolve
against the old animation's marker data. This reorders state entry to:

1. Clear stale marker before load
2. Load the new animation (with autoplay suppressed)
3. Apply marker against the newly loaded animation data
4. Set playback mode, then autoplay last

Also resets current_frame and updated flag in renderer clear() so stale
frame state from the previous animation does not carry over.
@changeset-bot

changeset-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4922138

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@theashraf theashraf changed the title fix: correct state entry ordering for cross-animation marker transitions fix: cross-animation state machine transitions Mar 31, 2026
@theashraf theashraf merged commit 9e55288 into main Apr 1, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Apr 10, 2026
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