Nodes

class manim_extensions.mindmap.Node(vmobject=None, buff=0.2, **kwargs)[source]

Bases: object

Tree-node class.

Example: NodeDocExample

../../_images/NodeDocExample-1.png
from manim import *
from manim_extensions.mindmap import Node

class NodeDocExample(Scene):
    def construct(self):
        root = Node(MathTex("Root", font_size=36))
        root.add_child(Node(MathTex("Child", font_size=36)))
        self.add(root.vmobject, root.surr_rect)
from manim import *
from manim_extensions.mindmap import Node

class NodeDocExample(Scene):
    def construct(self):
        root = Node(MathTex("Root", font_size=36))
        root.add_child(Node(MathTex("Child", font_size=36)))
        self.add(root.vmobject, root.surr_rect)

__init__(vmobject=None, buff=0.2, **kwargs)[source]
scale(scale_factor)[source]

Scale the node.

add_child(child)[source]

Add a child node.

remove_child(child)[source]

Remove a child node.

alter_content(vmobject)[source]

Replace the node content.

get_connector(layout_type, direction, **kwargs)[source]

Return the connector from this node to its parent based on layout type.

Return type:

Line

set_connector(layout_type, direction=array([1., 0., 0.]), **kwargs)[source]

Set the connector line.

change_connector(change_dir, change_layout, layout_type, direction=array([1., 0., 0.]), **kwargs)[source]

Change the connector line.

get_node_and_line_without_updater()[source]

Return the node and its connector, removing the connector updater.

Return type:

Group

get_children()[source]

Return all child nodes.

Return type:

List[Node]

get_descendants()[source]

Return all descendant nodes.

Return type:

List[Node]

get_children_mobjects()[source]

Return mobjects for all child nodes.

Return type:

Group

get_descendants_mobjects()[source]

Return mobjects for all descendant nodes.

Return type:

Group

get_root()[source]

Return the root node.

Return type:

Node

class manim_extensions.mindmap.NodeStyle(node_style=[{'color': ManimColor('#FC6255'), 'stroke_width': 8}, {'color': ManimColor('#58C4DD'), 'stroke_width': 6}, {'color': ManimColor('#F7D96F'), 'stroke_width': 4}, {'color': ManimColor('#83C167'), 'stroke_width': 4}], line_style=[{'color': ManimColor('#FC6255'), 'stroke_width': 8}, {'color': ManimColor('#58C4DD'), 'stroke_width': 6}, {'color': ManimColor('#F7D96F'), 'stroke_width': 4}, {'color': ManimColor('#83C167'), 'stroke_width': 4}], text_style=[{'color': ManimColor('#FC6255'), 'font_size': 64}, {'color': ManimColor('#F7D96F'), 'font_size': 56}, {'color': ManimColor('#83C167'), 'font_size': 48}, {'color': ManimColor('#FFFFFF'), 'font_size': 36}])[source]

Bases: object

Overall layout parameters and a list of node-style dicts indexed by node level.

__init__(node_style=[{'color': ManimColor('#FC6255'), 'stroke_width': 8}, {'color': ManimColor('#58C4DD'), 'stroke_width': 6}, {'color': ManimColor('#F7D96F'), 'stroke_width': 4}, {'color': ManimColor('#83C167'), 'stroke_width': 4}], line_style=[{'color': ManimColor('#FC6255'), 'stroke_width': 8}, {'color': ManimColor('#58C4DD'), 'stroke_width': 6}, {'color': ManimColor('#F7D96F'), 'stroke_width': 4}, {'color': ManimColor('#83C167'), 'stroke_width': 4}], text_style=[{'color': ManimColor('#FC6255'), 'font_size': 64}, {'color': ManimColor('#F7D96F'), 'font_size': 56}, {'color': ManimColor('#83C167'), 'font_size': 48}, {'color': ManimColor('#FFFFFF'), 'font_size': 36}])[source]
get_node_style(level)[source]

Return the node style for the given level.

Return type:

Dict

get_line_style(level)[source]

Return the line style for the given level.

Return type:

Dict

get_text_style(level)[source]

Return the text style for the given level.

Return type:

Dict

manim_extensions.mindmap.bfs_walker(root)[source]

Breadth-first, level-order traversal: first-in-first-out using a queue.

Return type:

Generator

manim_extensions.mindmap.dfs_walker(root)[source]

Depth-first, pre-order traversal: last-in-first-out using a stack.

Return type:

Generator