ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
26.7k stars 1.83k forks source link

Allow animations with `run_time=0` and implement convenience `Add` animation #4017

Open chopan050 opened 1 week ago

chopan050 commented 1 week ago

Closes #4004

This PR refactors the Animation.run_time validation. Instead of checking in Animation.begin() that each individual animation has a positive run_time which is large enough for the current frame rate, we now have the following:

This PR also introduces a convenience animation: Add. It is similar to Scene.add, but it's an animation which can be grouped inside other animations and has a default run_time of 0. Thus, if people needs to instantly add Mobjects in the middle of an animation, they can now do so in an easier way.

Examples for using Add are also provided in the documentation: https://manimce--4017.org.readthedocs.build/en/4017/reference/manim.animation.animation.Add.html

Reviewer Checklist