其他分享
首页 > 其他分享> > 【Manim CE】常用Mobject

【Manim CE】常用Mobject

作者:互联网

当前文档版本:v0.16.0.post0

VMobject


继承自Mobject

V的意思是向量化的,vectorized mobject

fill_color=None, fill_opacity=0.0, stroke_color=None, stroke_opacity=1.0, stroke_width=DEFAULT_STROKE_WIDTH, background_stroke_color=BLACK, background_stroke_opacity=1.0, background_stroke_width=0, sheen_factor=0.0, sheen_direction=UL, close_new_points=False, pre_function_handle_to_anchor_scale_factor=0.01, make_smooth_after_applying_functions=False, background_image=None, shade_in_3d=False, tolerance_for_point_equality=1e-6, n_points_per_cubic_curve=4, **kwargs

构造参数:

 

几何


Circle 圆

manim.mobject.geometry.arc.Circle

radius: float | None = None, color: Color | str = RED, **kwargs,

构造参数:

构造示例:

from manim import *

class CircleExample(Scene):
    def construct(self):
        circle_1 = Circle(radius=1.0)
        circle_2 = Circle(radius=1.5, color=GREEN)
        circle_3 = Circle(radius=1.0, color=BLUE_B, fill_opacity=1)

        circle_group = Group(circle_1, circle_2, circle_3).arrange(buff=1)
        self.add(circle_group)

 

Dot 点

manim.mobject.geometry.arc.Dot

point: list | np.ndarray = ORIGIN, radius: float = DEFAULT_DOT_RADIUS, stroke_width: float = 0, fill_opacity: float = 1.0, color: Color | str = WHITE,

构造参数:

构造示例:

from manim import *

class DotExample(Scene):
    def construct(self):
        dot1 = Dot(point=LEFT, radius=0.08)
        dot2 = Dot(point=ORIGIN)
        dot3 = Dot(point=RIGHT)
        self.add(dot1,dot2,dot3)

 

Ellipse 椭圆

manim.mobject.geometry.arc.Ellipse

width: float = 2, height: float = 1, **kwargs

 构造参数:

 构造示例:

from manim import *

class EllipseExample(Scene):
    def construct(self):
        ellipse_1 = Ellipse(width=2.0, height=4.0, color=BLUE_B)
        ellipse_2 = Ellipse(width=4.0, height=1.0, color=BLUE_D)
        ellipse_group = Group(ellipse_1,ellipse_2).arrange(buff=1)
        self.add(ellipse_group)

 

Angle 角

manim.mobject.geometry.line.Angle 

line1: Line, line2: Line, radius: float = None, quadrant=(1, 1), other_angle: bool = False, dot=False, dot_radius=None, dot_distance=0.55, dot_color=WHITE, elbow=False, **kwargs,

构造参数:

构造示例:

from manim import *

class RightArcAngleExample(Scene):
    def construct(self):
        line1 = Line( LEFT, RIGHT )
        line2 = Line( DOWN, UP )
        rightarcangles = [
            Angle(line1, line2, dot=True),
            Angle(line1, line2, radius=0.4, quadrant=(1,-1), dot=True, other_angle=False),
            Angle(line1, line2, radius=0.5, quadrant=(-1,1), stroke_width=8, dot=True, dot_color=YELLOW, dot_radius=0.04, other_angle=True),
            Angle(line1, line2, radius=0.7, quadrant=(-1,-1), color=RED, dot=True, dot_color=GREEN, dot_radius=0.08),
        ]
        plots = VGroup()
        for angle in rightarcangles:
            plot=VGroup(line1.copy(),line2.copy(), angle)
            plots.add(plot)
        plots.arrange(buff=1.5)
        self.add(plots)

 

 

Line 线

manim.mobject.geometry.line.Line

start=LEFT, end=RIGHT, buff=0, path_arc=None, **kwargs

构造参数:

构造示例:

from manim import *

class LineExample(Scene):
    def construct(self):
        ax = Axes()
        line1 = Line(ax.c2p(1,-3),ax.c2p(1,3),buff=0)
        line2 = Line(ax.c2p(2,-3),ax.c2p(2,3),buff=1)
        line3 = Line(ax.c2p(2,-3),ax.c2p(2,3),path_arc=PI)
        self.add(ax,line1,line2,line3)

 

标签:color,float,CE,stroke,radius,Line,Mobject,dot,Manim
来源: https://www.cnblogs.com/remyuu/p/16632726.html