Animation Scheduling
Animation Scheduling has introduced the algorithm to schedule animations. This page introduces the data structure for animation scheduling.
isa_manim.isa_scene.isa_animate.IsaAnimateItemprovides the data structure of one single animation, includingIsaAnimateItemof dependency objects.isa_manim.isa_scene.isa_animate._IsaAnimateSectionprovides the data structure of one animation section.isa_manim.isa_scene.isa_animate._IsaAnimateStepprovides the data structure of one animation step.
isa_manim.isa_scene.isa_animate.IsaAnimationFlow provides the animation scheduling.
add_animation is called to generate the IsaAnimationItem and recognize the
dependency with registered animations when registering one animation. At the end of one
section, switch_section is called to generate the _IsaAnimateSection.
When sequentially calling
switch_sectionmore than once, the final efforts look like the intersection of twoswitch_section.
When rendering the animation, analysis_animation_flow is called to analyze the
animation flow and generate _IsaAnimateStep. As the result of the animation flow
algorithm, animation steps are stored in animation_step_list.
IsaAnimateItem
Data structure for animate for dependency analysis.
It contains the list of source items and destination items of one item, which can conclude the dependency of animations.
It also has a list of dependency items, which must be maintained in scene during this animation.
Attributes:
| Name | Type | Description |
|---|---|---|
animate |
Animation
|
Animate |
src_item_list |
List[Mobject]
|
List of source items. |
dst_item_list |
List[Mobject]
|
List of destination items. |
dep_item_list |
List[Mobject]
|
List of dependency items. |
predecessor_list |
List[Self]
|
List of predecessor animates. |
successor_list |
List[Self]
|
List of successor animates. |
__init__(animate, src, dst, dep=None, add_before=None, add_after=None, rm_before=None, rm_after=None)
Construct one data structure for animate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
animate
|
Animation
|
One animation. |
required |
src
|
List[Mobject]
|
Source Objects. |
required |
dst
|
List[Mobject]
|
Destination Objects. |
required |
dep
|
List[Mobject]
|
Dependency Objects. |
None
|
add_before
|
List[Mobject]
|
Objects to add before this animation. |
None
|
add_after
|
List[Mobject]
|
Objects to add after this animation. |
None
|
rm_before
|
List[Mobject]
|
Objects to remove before this animation. |
None
|
rm_after
|
List[Mobject]
|
Objects to remove after this animation. |
None
|
has_background(dep)
Check whether dep is background of this item. Background item should not change during this animation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dep
|
Mobject
|
Another manim object. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Return true if |
is_beginner()
Check whether this item is a beginner of a dependency chain.
Returns:
| Type | Description |
|---|---|
bool
|
Return True if animate does not have source item. |
is_predecessor_of(post)
Check whether this item is predecessor of post. Successor post should play
after this animation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post
|
Self
|
Another animation item. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Return True if one of the destination item of this animation is also a
source item of the |
is_successor_of(pre)
Check whether this item is successor of pre. Predecessor pre should play
before this animation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pre
|
Self
|
Another animation item. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Return True if one of the source item of this animation is also a
destination item of the |
is_terminator()
Check whether this item is a terminator of a dependency chain.
Returns:
| Type | Description |
|---|---|
bool
|
Return True if animate does not have destination item. |
_IsaAnimateSection
One section of ISA Animation.
Attributes:
| Name | Type | Description |
|---|---|---|
animate_list |
List[IsaAnimateItem]
|
List of animation. |
wait |
int
|
Wait time after this section. <=0 means no wait. |
fade_out |
bool
|
Whether fade out left items after this section. |
camera_animate |
Tuple[float, ndarray]
|
Animation of move camera before this section, which is a tuple of one float and a position. The float provides the scaling of camera while position provides the new central position of camera. |
keep_objects |
List[Mobject]
|
List of objects that keep on scene between section. |
_IsaAnimateStep
One step of ISA Animation, which contains a set of animations that can play simultaneously.
Attributes:
| Name | Type | Description |
|---|---|---|
animate_list |
List[IsaAnimateItem]
|
List of animation. |
wait |
int
|
Wait time after this step. <=0 means no wait. |
camera_animate |
Tuple[float, ndarray]
|
Animation of move camera before this section, which is a tuple of one float and a position. The float provides the scaling of camera while position provides the new central position of camera. |
add_before |
List[Mobject]
|
Objects to add before this animation. |
add_after |
List[Mobject]
|
Objects to add after this animation. |
rm_before |
List[Mobject]
|
Objects to remove before this animation. |
rm_after |
List[Mobject]
|
Objects to remove after this animation. |
IsaAnimationFlow
This class is used to analyse the order of animations.
Attributes:
| Name | Type | Description |
|---|---|---|
isa_animation_section_list |
List of ISA animation section, which contains a set of animations. |
|
isa_animation_step_list |
List of ISA step section, which contains a set of animations after analysis animation flow. |
|
_section_animate_list |
List of animations after previous section, which will be packed into one section. |
add_animation(animate, src, dst, dep=None, add_before=None, add_after=None, remove_before=None, remove_after=None)
Register animation to scene and build dependency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
animate
|
Animation
|
One Manim animation. |
required |
src
|
List[Mobject]
|
List of source objects of this animation. |
required |
dst
|
List[Mobject]
|
List of destination objects of this animation. |
required |
dep
|
List[Mobject]
|
List of dependency objects of this animation. |
None
|
add_before
|
List[Mobject]
|
List of objects to add into the scene before this animation. |
None
|
add_after
|
List[Mobject]
|
List of objects to add into the scene after this animation. |
None
|
remove_before
|
List[Mobject]
|
List of objects to remove from the scene before this animation. |
None
|
remove_after
|
List[Mobject]
|
List of objects to remove from the scene after this animation. |
None
|
Returns:
| Type | Description |
|---|---|
IsaAnimateItem
|
Return an entity of data structure for animation flow analysis. |
analysis_animation_flow()
Analysis the data flow and organize animations into several step.
switch_section(wait=0, fade_out=True, camera_animate=None, keep_objects=None)
Switch animation section.
Save registered animate to an animate section structure and clear animation list for next section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wait
|
float
|
Seconds to wait before end of this section. |
0
|
fade_out
|
bool
|
True means clear all items at the end of this section. |
True
|
camera_animate
|
Tuple[float, ndarray]
|
Animate to scale/move camera. |
None
|
keep_objects
|
List[Mobject]
|
Objects keep on the scene between sections |
None
|