fix: 🐛 on_loop/on_complete events are not triggered when in Reverse/Forward modes #77
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.
Issue 1:
on_loop
/on_complete
event isn't consistently triggered inReverse
/Forward
modes because it doesn't reach the last frame properly.Fix 1:
Modify the
handle_reverse_mode
andhandle_forward_mode
functions to always return the last frame number once a loop is completed. This adjustment ensures that the animation progresses smoothly, allowing therequest_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 thestart_time
while the animation is playing. This behavior can cause problems, particularly with accuracy differences across platforms, leading to the animation loop constantly updating thestart_time
as the animation progresses. To resolve this, provide an independentseek
method to handle seeking behavior, ensuring that theset_frame
function remains pure and is only used in the animation loop.Issue 2: