반응형
Line: draw simple line
grid = self.get_grid(-7, 7, 1, -4, 4, 1)
self.add(grid)
line = Line(stroke_color=RED, stroke_width=8)
self.add(line)
self.wait()
Line: draw line between two points
a = np.array([-1,1,0])
b = np.array([1, -1, 0])
line = Line(a,b)
self.add(line)
self.wait()
Line: stroke_color, stroke_width
line = Line(stroke_color=RED, stroke_width=6)
def change_stroke_width(self):
def get_line(w):
line = Line(stroke_width=w)
t = Text(str(w), size=0.3, stroke_width=0).next_to(line, LEFT, buff=0.2)
return VGroup(t,line)
lines = VGroup(*[get_line(w) for w in range(1,11)])
lines.to_edge(UP, buff=0.5).arrange(DOWN, buff=0.5)
self.add(lines)
self.wait()
DashedLine
line_1 = DashedLine(LEFT, RIGHT*2)
line_2 = DashedLine(LEFT, RIGHT)
line_2.set_length(3)
line_3 = DashedLine(LEFT, UR, color=RED, opacity=0.7, stroke_width=10)
line_3.set_length(3)
DashedLine: dash_length
n = [0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3]
group = VGroup()
for k in n:
text = Text("dash_length=" + str(k), size=0.2, stroke_width=0)
line = DashedLine(LEFT*3,RIGHT, dash_length=k)
line.next_to(text,RIGHT)
group.add(VGroup(text,line))
group.to_edge(UP,buff=1)
group.arrange(DOWN, buff=0.5)
self.add(group)
self.wait()
반응형
'Programming > Manim code' 카테고리의 다른 글
[020]Vector/TangentLine (0) | 2020.05.06 |
---|---|
[019]Arrow/DoubleArrow (0) | 2020.05.06 |
[016]Mobject Class Diagram (0) | 2020.05.06 |
[015]Text: font size (0) | 2020.05.05 |
[014]Text/TextMobject/TexMobject (0) | 2020.05.05 |