본문 바로가기

Programming/Manim Lectures

[05-3-G]Arc series(2/2): Circle/Dot/CurvedDoubleArrow/...

반응형

Circle class

object > Container > Mobject > VMobject > TipableVMobject > Arc > Circle
manimlib.mobject.geometry.Circle(self, **kwargs)

Creates a circle object

    CONFIG = {
        "color": RED,
        "close_new_points": True,
        "anchors_span_full_range": False
    }
Parameters:  **kwargs
    CONFIG values of Circle and Arc/TipableVMobject/VMobject/Mobject
    
    - color=RED: Color around the circle or inside. 
    
                 In the case of Circle, fill_opacity=0, so it does not affect the internal color, 
                 only the line around the circle.
                 
    - radius=1.0: The radius of the circle. Default value is 1.0 and it is defined in Arc
    
    - arc_center=ORIGIN: Position of the circle center
    
    - fill_color=None: color for circle's inner space
    
    - fill_opacity=0.0: transparancy of circle inner space.     
                  Since the default value is 0.0, to fill the inside of the circle with some color, 
                  fill_opacity must be greater than 0 and fill_color must be specified.
                  
    - stroke_opacity=1.0: Transparency for line around circle
    
    - stroke_width=DEFAULT_STROKE_WIDTH=4: Thickness of the line around the circle

 

If we make a circle with radius=1, line thickness=6, line color=RED, and inner color is BLUE,

        circle1 = Circle(
            radius=1,
            stroke_width=6,
            stroke_color=RED,
            fill_opacity=1.0,
            fill_color=BLUE)
As the parameter value, color is used as the line or internal color of the Mobject object.

At this time, stroke_opacity>0 indicates the color value on the outer line of the object, and fill_opacity>0 indicates the internal color.

To clarify whether it is a line color or an internal color, it is better to specify it using stroke_color and fill_color.

 

The code below is an animation that moves the blue circle from left to right on the screen and gradually turns into a red circle.

 

    def circle_test(self):
        circle1 = Circle(
            radius=1,
            stroke_width=6,
            stroke_color=RED,
            fill_opacity=1.0,
            fill_color=BLUE)
        circle2 = circle1.copy()
        circle2.set_fill(color=RED,opacity=1.0)

        circle1.to_edge(LEFT)
        circle2.to_edge(RIGHT)

        self.add(circle1)
        self.play(
            Transform(circle1,circle2),
            run_time=4,
        )
        self.wait()


Dot class

object > Container > Mobject > VMobject > TipableVMobject > Arc > Circle > Dot
manimlib.mobject.geometry.Dot(self, point=ORIGIN, **kwargs)

Create a dot. The dot is a circle painted inside.

 

    CONFIG = {
        "radius": DEFAULT_DOT_RADIUS,
        "stroke_width": 0,
        "fill_opacity": 1.0,
        "color": WHITE
    }
Parameters: point=ORIGIN
    The center of the point

Parameters:  **kwargs
    CONFIG values of Dot and Circle/Arc/TipableVMobject/VMobject/Mobject

    - radius=DEFAULT_DOT_RADIUS=0.08: radius of the dot
    - fill_opacity=1.0: Internal transparency   
    - color=WHITE 
    - fill_color=None: color of inner space for the dot
    - stroke_width=0 : The thickness of the line. 
                       Because it is a point, the default is 0, 
                       and there is no outline.
    - stroke_opacity=1.0: Transparency for the line. 
                          Default is 1.0, but stroke_width=0, so no line is displayed
    - stroke_color=None: Coloring for outline.    

 

By default, a white dot with a radius of 0.08 and no outline is created. The location is the center origin of the screen.

 

dot = Dot()

CurvedDoubleArrow class

object > Container > Mobject > VMobject > TipableVMobject > Arc > ArcBetweenPoints > CurvedArrow > CurvedDoubleArrow
manimlib.mobject.geometry.CurvedDoubleArrow(self, start_point, end_point, **kwargs)

Create an arc with arrows at both ends connecting between two points.

 

curved_arrow = CurvedDoubleArrow(LEFT, RIGHT)
Parameters: start_point
    Value at which the arc begins. numpy array type

Parameters: end_point
    Value at which the arc ends. numpy array type

Parameters: **kwargs
    CONFIG values of Arc/TipableVMobject/VMobject/Mobject

    - radius=DEFAULT_DOT_RADIUS=0.08: radius of the arc
    - fill_opacity=1.0: transparancy of the inner space
    - color=WHITE : color of the line or the inner space
    - fill_color=None: color of the inner space 
    - stroke_width=0: line thickness. default is zeor
    - stroke_opacity=1.0: line opacity. 
                       default is 1.0, however the line is invisible because stroke_width=0
    - stroke_color=None: line color

SmallDot class

object > Container > Mobject > VMobject > TipableVMobject > Arc > Circle > Dot > SmallDot
manimlib.mobject.geometry.SmallDot(self, point=ORIGIN, **kwargs)

Create small dots.
The Dot has a radius of 0.08, whereas the SmallDot has a radius of 0.04.

 

    CONFIG = {
        "radius": DEFAULT_SMALL_DOT_RADIUS,
    }
Parameters: point=ORIGIN
    The center of the point

Parameters:  **kwargs
    CONFIG values of SmallDot and Dot/Circle/Arc/TipableVMobject/VMobject/Mobject

    - fill_opacity=1.0: Internal color transparency.   
    - color=WHITE : color of the line of inner space
    - fill_color=None: color of inner space 
    - stroke_width=0 : line thickness. 
                  Because it is a dot, the default is 0, so the line is not visible
    - stroke_opacity=1.0: Transparency for the line around the circle. 
                          Default is 1.0, but stroke_width=0, so no line is displayed
    - stroke_color=None: line color

Ellipse class

object > Container > Mobject > VMobject > TipableVMobject > Arc > Circle > Ellipse
manimlib.mobject.geometry.Ellipse(self, **kwargs)

Create an ellipse.
It is the same as Circle, except that width> height.

 

ellipse = Ellipse()

    CONFIG = {
        "width": 2,
        "height": 1
    }
Parameters:  **kwargs
    CONFIG values of Ellipse and Circle/Arc/TipableVMobject/VMobject/Mobject

    -width=2: width value of the ellipse 
    -height=1: height value of the ellipse

    - color=RED: Color around the circle or inside the circle. 
                 In the case of Circle, fill_opacity=0, 
                 so it does not affect the internal color, but only for the line around the circle.
    - radius=1.0: Radius of the ellipse. Default value is 1.0
    - arc_center=ORIGIN: The center position of the ellipse
    - fill_color=None: The color of the inner space of ellipse
    - fill_opacity=0.0: Internal color transparency. 
                        Since the default value is 0.0, 
                        to fill the inside of the circle with some color, 
                        fill_opacity must be greater than 0 and fill_color must be specified.
    - stroke_opacity=1.0: The opacity for the line
    - stroke_width=DEFAULT_STROKE_WIDTH=4: Line thickness

Annulus

object > Container > Mobject > VMobject > TipableVMobject > Arc > Circle > Annulus
manimlib.mobject.geometry.Annulus(self, **kwargs)

Make a annulus. The annulus is like a donut.


By default, the outer circle is 2, the inner circle is 1.

Inner circle's color is black, and outter circle's color is white.

 

annulus = Annulus()

 

    CONFIG = {
        "inner_radius": 1,
        "outer_radius": 2,
        "fill_opacity": 1,
        "stroke_width": 0,
        "color": WHITE,
        "mark_paths_closed": False,
    }
Parameters:  **kwargs
    CONFIG values of Annulus and Circle/Arc/TipableVMobject/VMobject/Mobject

    - inner_radius=1: radius value of the inner circle
    - outer_radius=2: radius value of the outer circle
    - fill_opacity=1: opacity value to fill
    - stroke_width=0: the thickness of the outline
    - color=WHITE: color of inner space or line. In here, it's for the inner space color
    - arc_center=ORIGIN: the certer of the circle

AnnularSector class

object > Container > Mobject > VMobject > TipableVMobject > Arc > AnnularSector
manimlib.mobject.geometry.AnnularSector(self, start_angle=0, angle=TAU / 4, **kwargs)

Make a partial annular(ring).

 

a_sector = AnnularSector()

    CONFIG = {
        "inner_radius": 1,
        "outer_radius": 2,
        "angle": TAU / 4,
        "start_angle": 0,
        "fill_opacity": 1,
        "stroke_width": 0,
        "color": WHITE,
    }
Parameters:start_angle=0
    Starting angle. 
    The default is 0 (zero). 
    Specifies the angle value of the point where the AnnularSector starts. 
    Unit is radians

Parameters: angle=TAU / 4
    The angle of created AnnularSector. 
    The angle is start from the 'start_angle' to counterclockwise direction.

Parameters: **kwargs
    CONFIG values of AnnularSector and Arc/TipableVMobject/VMobject/Mobject
  
    - inner_radius=1: radius value for inner circle
    - outer_radius=2: radius value for the outer circle
    - angle = TAU/4: angle to be drawed
    - start_angle=0: starting point's angle. x-axis is zero.
    - -fill_opacity=1: opacity to be filled
    - stroke_width=0: line thickness
    - color=WHITE: color to be filled

Sector class

object > Container > Mobject > VMobject > TipableVMobject > Arc > AnnularSector > Sector
manimlib.mobject.geometry.Sector(self, start_angle=0, angle=TAU / 4, **kwargs)

Create a fan-shaped circle.

 

A fan-shaped circle, a Sector, can be said to be a partial ring with an internal circle's radius is zero.
sector = Sector()

    CONFIG = {
        "outer_radius": 1,
        "inner_radius": 0
    }
Parameters:start_angle=0
    The angle of the starting point. 
    Default value is zero.
    The unit is radians.
    
Parameters: angle=TAU / 4
    The angle to be created.
    The Sector is drawed starting from the 'start_angle' point to the 'angle' value of the point.
    
Parameters: **kwargs
    CONFIG value of Sector and AnnularSector/Arc/TipableVMobject/VMobject/Mobject
  
    - inner_radius=0: The radius value of the inner circle. 
                      Default is zero. If this value larger than zero, it becomes a AnnualSector.
    - outer_radius=1: The radius value of the Sector
    - angle = TAU/4: The angle to be drawed.
    - start_angle=0: The angle of the starting point. 
    - -fill_opacity=1: Opacity of inner sapce
    - stroke_width=0: Line thickness
    - color=WHITE: Color to be filled

Next: [05-4] Numbers: DecimalNumber/Integer

 

[05-4] Numbers: DecimalNumber/Integer

In Manim, there are two kinds of classes that displays numbers on the screen. DecimalNumber and Integer DecimalNumber class can represent a general number including a decimal point, and Integer clas..

infograph.tistory.com

Go To: [99] Table of Contents

반응형