To be frank, I don't know all the details about making your own custom Animation class. I know only a general idea, but the details are fuzzy. I usually end up using a trial-and-error approach trying different methods and reading the source code of similar animations, until it works. But the main idea is:
- An animation receives a
mobject
(it can be a group) on which it will operate. In the__init__
method usually it only stores that object intoself.mobject
, so every animation has that object, and other animation attributes such as the run time, rate function, etc. - When used in a
.play()
, manim will call itsbegin()
method. Usually you don't need to override that. The default implementation creates another inner object calledself.starting_mobject
which stores the initial state of the mobject being animated, and it is simply a deep copy ofself.mobject
(although you can override how that starting mobject is created by overriding `create_starting_mobj