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

Allow to suspend and resume updating smoothly #1873

Closed

Conversation

leleogere
Copy link
Contributor

@leleogere leleogere commented Aug 6, 2021

Overview: What does this pull request change?

Modification of update, suspend_updating and resume_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:

my_object.suspend_updating()
my_object.suspend_updating(run_time=3)
my_object.suspend_updating(recursive=False, run_time=3)
my_object.suspend_updating(run_time=5, rate_func=smooth)

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

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Léo Géré added 2 commits August 6, 2021 18:09
BREAKING CHANGE: attribute self.updating_suspended is not available anymore (replaced by self.updating_speed and self.updating_variation)
@leleogere leleogere marked this pull request as ready for review August 6, 2021 17:08
@leleogere leleogere marked this pull request as draft August 6, 2021 17:09
@MrDiver MrDiver added the new feature Enhancement specifically adding a new feature (feature request should be used for issues instead) label Jun 18, 2022
@MrDiver
Copy link
Collaborator

MrDiver commented Jun 18, 2022

Any updates on this ?

@leleogere
Copy link
Contributor Author

Any updates on this ?

No sorry, I put this aside for now, it has too much issues (e.g. with the caching system). I might give it another attempt when we will have a cleaner architecture. You can close it for now, I won't have probably the time/motivation to work on it for the next few months.

@MrDiver MrDiver closed this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Enhancement specifically adding a new feature (feature request should be used for issues instead) to be closed down
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

None yet

2 participants