Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 on_loop/on_complete events are not triggered when in Reverse/Forward modes #77

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

theashraf
Copy link
Member

Issue 1:

  • The on_loop / on_complete event isn't consistently triggered in Reverse/Forward modes because it doesn't reach the last frame properly.

Fix 1:

  • Modify the handle_reverse_mode and handle_forward_mode functions to always return the last frame number once a loop is completed. This adjustment ensures that the animation progresses smoothly, allowing the request_frame function to tick to the next frame based on the current animation state, and ensures the loop/complete events are triggered.

  • Address the issue with the set_frame function, which updates the start_time while the animation is playing. This behavior can cause problems, particularly with accuracy differences across platforms, leading to the animation loop constantly updating the start_time as the animation progresses. To resolve this, provide an independent seek method to handle seeking behavior, ensuring that the set_frame function remains pure and is only used in the animation loop.

Issue 2:

  • The "play" method doesn't reset the direction and the current_frame if the animation is playing from the stopped playback_state.

Copy link

changeset-bot bot commented Feb 5, 2024

⚠️ No Changeset found

Latest commit: 98b6ac3

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: 🐛 on_loop event not triggered for Reverse/Forward modes fix: 🐛 on_loop/on_complete events are not triggered when in Reverse/Forward modes Feb 5, 2024
@theashraf theashraf merged commit a4d47c4 into main Feb 5, 2024
1 check passed
This was referenced Feb 20, 2024
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.

2 participants