Allow to suspend and resume updating smoothly #1873
Closed
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.
Overview: What does this pull request change?
Modification of
update
,suspend_updating
andresume_updating
functions of Mobjects to be able to suspend and resume updating smoothly instead of instantaneously.Deletion of the attribute
updating_suspended
of Mobject.Addition of the attributes
updating_speed
which represent the speed of the updater (0 for stopped, 1 for full speed, in between for intermediate speeds).Addition of the attribute
updating_variation
which represent the acceleration of the updating (deceleration if negative).Motivation and Explanation: Why and how do your changes improve the library?
When dealing with objects with updaters, I sometimes need to temporary suspend the animation to enhance a specific point for example. Until now, the only way was to use
my_object.suspend_updating()
, which interrupts the animation too abruptly. I wanted a way to better control this interruption.With this PR, we are now able to do things like:
And of course the same parameters are usable with
resume_updating
.Smooth_updaters.mp4
Links to added or changed documentation pages
Small modifications to reflect the new parameters.
https://docs.manim.community/en/stable/reference/manim.mobject.mobject.Mobject.html?highlight=suspend_updating#manim.mobject.mobject.Mobject.suspend_updating
https://docs.manim.community/en/stable/reference/manim.mobject.mobject.Mobject.html?highlight=suspend_updating#manim.mobject.mobject.Mobject.resume_updating
https://docs.manim.community/en/stable/reference/manim.mobject.mobject.Mobject.html?highlight=suspend_updating#manim.mobject.mobject.Mobject.update
Further Information and Comments
I'm facing issues when the flag
--disable_caching
is not passed. It looks like the renderer doesn't make well the link between animations. I don't know how to fix this tho...Smooth_updaters_caching_issue.mp4
EDITS
I'm not currently working on this PR as issues with frame number have not been resolved yet and are likely causing problems to my implementation (see #698).
Reviewer Checklist