The arc's representative class is Arc, and the Circle and Dot classes inherit it.
Here, we mainly focus on the Arc, ArcBetweenPoints, CurvedArrow, Circle, and Dot classes, and the rest of the classes are low in frequency, so we will only explain the class structure.
Arc class
object > Container > Mobject > VMobject > TipableVMobject > Arc
manimlib.mobject.geometry.Arc(self, start_angle=0, angle=TAU / 4, **kwargs)
Start at 'start_angle' and make an arc equal to the angle. The base of the angle is 0 in the x-axis, the angle increases in the counterclockwise direction, and the unit is radians.
CONFIG = {
"radius": 1.0,
"num_components": 9,
"anchors_span_full_range": True,
"arc_center": ORIGIN,
}
Parameters:start_angle=0
Start angle. The default is 0 (zero).
Specifies the angle value of the point where the arc starts. Unit is radians
Parameters: angle=TAU / 4
The angle of the arc to be generated.
Starting at the point of start_angle, the arc of the angle is drawn.
Parameters: **kwargs
CONFIG values of Arc and TipableVMobject/VMobject/Mobject
- radius=1.0: radius of the arc
- arc_center = ORIGIN: the direction of arc center
- stroke_width=DEFAULT_STROKE_WIDTH=4: line thickness
- color=WHITE: line color
There are six elements required to draw an arc.
When you create an arc with arc = Arc() with a fault, the following arc is drawn.
1) With the origin as the center of the arc (arc_center=ORIGIN)
2) Start angle is 0 (start_angel=0)
3) The radius is 1.0 (radius=1.0)
4) The angle of the arc is TAU/4 = 90 degrees (angle=TAU/4)
5) Line thickness is 4 (stroke_width=4)
6) The color of the line is WHITE (color=WHITE)
ArcBetweenPoints class
object > Container > Mobject > VMobject > TipableVMobject > Arc > ArcBetweenPoints
manimlib.mobject.geometry.ArcBetweenPoints(self, start, end, angle=TAU / 4, **kwargs)
Draw an arc connecting the two points. The degree of arc bending is determined by the 'angle' value. The greater the angle value, the greater the degree of bending.
Parameters:start
Value at which the arc begins. numpy array type
Parameters: end
Value at which the arc ends. numpy array type
Parameters: angle=TAU / 4
The angle between the two points connecting the arc and the center point.
Determines the degree of arc bending.
Values greater than 0 and less than TAU=2*PI.
The closer to 0, the flatter the arc shape, and the closer to TAU, the closer the circle.
Parameters: **kwargs
CONFIG values of Arc/TipableVMobject/VMobject/Mobject
- stroke_width=DEFAULT_STROKE_WIDTH=4: line thickness
- color=WHITE: line color
Draw an arc connecting the two points. The degree of arc bending is determined by the 'angle' value.
When the 'angle' is close to 0, it is a straight line, and as the 'angle' increases, it becomes closer to the circle.
def arc_between_test1(self):
values = [PI/8, PI/4, PI/2, PI, 3*PI/2]
strs = ["PI/8", "PI/4", "PI/2", "PI", "3*PI/2"]
def get_arc_text(str, angle_value):
arc = ArcBetweenPoints(LEFT, RIGHT, angle=angle_value)
num = Text(str, size=0.35, stroke_width=0).next_to(arc,UP)
return VGroup(arc,num)
arcs = VGroup(*[get_arc_text(str,angle_value) for str, angle_value in zip(strs,values)])
arcs.arrange(RIGHT)
self.add(arcs)
self.wait()
By adjusting the size of the 'angle', you can create an animation that makes the arc size smaller and larger.
Use the ValueTracker to create a variable value, and use the always_redraw method to update the arc.
def arc_between_test(self):
tracker = ValueTracker(1.15)
arc = ArcBetweenPoints(LEFT+UP*2,RIGHT+UP*2, angle=TAU/1.15)
arc = always_redraw(lambda : ArcBetweenPoints(LEFT+UP*2,RIGHT+UP*2, angle=TAU/tracker.get_value()))
self.add(arc)
self.play(tracker.set_value, 8, rate_func=there_and_back, run_time=4)
self.wait()
CurvedArrow class
object > Container > Mobject > VMobject > TipableVMobject > Arc > ArcBetweenPoints > CurvedArrow
manimlib.mobject.geometry.CurvedArrow(self, start_point, end_point, **kwargs)
Same as ArcBetweenPoints class, but only with an arrow at the end.
angle=TAU/4 is the default
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
- angle=TAU / 4: The angle between the two points connecting the arc and the center point.
Determines the degree of arc bending.
Values greater than 0 and less than TAU=2*PI.
The closer to 0, the flatter the arc shape, and the closer to TAU,
the closer the circle.
- stroke_width=DEFAULT_STROKE_WIDTH=4: line thickness
- color=WHITE: line color
Next: [05-3-G]Arc series(2/2): Circle/Dot/CurvedDoubleArrow/...
Go To: [99] Table of Contents
'Programming > Manim Lectures' 카테고리의 다른 글
[05-4] Numbers: DecimalNumber/Integer (0) | 2020.06.07 |
---|---|
[05-3-G]Arc series(2/2): Circle/Dot/CurvedDoubleArrow/... (0) | 2020.06.07 |
[05-3-E] Polygon series(2/2): Rectangle/Square/Rounded Rectangle (0) | 2020.06.07 |
[05-3-D] Polygon series(1/2): Polygon/Triangle/ArrowTip (0) | 2020.06.07 |
[05-3-C] Line : Arrow/Vector (0) | 2020.06.07 |