반응형
Arrow
arrow = Arrow()
Arrow: draw arrow between two points
arrow = Arrow(DOWN, UP)
Arrow: buff, scale
class Arrow_Buff(Scene):
def construct(self):
buff_changed = Arrow_Buff.get_buff_changed()
scale_changed = Arrow_Buff.get_scale_changed()
buff_changed.to_corner(UL, buff=1)
buff_changed.arrange(DOWN, center=False, aligned_edge=LEFT)
scale_changed.to_edge(UP, buff=1)
scale_changed.arrange(DOWN, center=False, aligned_edge=LEFT)
#3. Show
self.add(buff_changed, scale_changed)
self.wait()
def get_scale_changed():
n=np.arange(0,2.1,0.2)
group = VGroup()
for k in n:
k = round(k,1)
arrow = Arrow()
arrow.scale(k)
text = Text("scale:"+str(k),size=0.2,stroke_width=0)
text.next_to(arrow,RIGHT)
group.add(VGroup(arrow,text))
return group
def get_buff_changed():
buff_size = [0,SMALL_BUFF,MED_SMALL_BUFF,MED_LARGE_BUFF]
texts = ["0","SMALL_BUFF","MED_SMALL_BUFF","MED_LARGE_BUFF"]
group = VGroup()
for t, s in zip(texts,buff_size):
arrow = Arrow(buff=s)
text = Text(t, size=0.2, stroke_width=0)
text.next_to(arrow,RIGHT)
group.add(VGroup(arrow,text))
return group
Arrow: tip_length
class Arrow_TipLength(Scene):
def construct(self):
size = np.arange(0,0.41,0.05)
g = VGroup()
for s in size:
s = round(s,2)
arrow = Arrow(tip_length=s)
text = Text("tip_length="+str(s), size=0.3, stroke_width=0)
text.next_to(arrow,RIGHT)
g.add(VGroup(arrow,text))
g.to_edge(UP,buff=1)
g.arrange(DOWN, aligned_edge=LEFT)
self.add(g)
self.wait()
Arrow.tip
arrow = Arrow()
arrow.tip.scale(0.75)
arrow.tip.set_stroke(WHITE, width=5)
arrow.tip.set_fill(opacity=0)
DoubleArrow
d_arrow = DoubleArrow(LEFT, RIGHT)
d_arrow.set_length(5)
반응형
'Programming > Manim code' 카테고리의 다른 글
[021]Polygon (0) | 2020.05.06 |
---|---|
[020]Vector/TangentLine (0) | 2020.05.06 |
[018]Line/DashedLine (0) | 2020.05.06 |
[016]Mobject Class Diagram (0) | 2020.05.06 |
[015]Text: font size (0) | 2020.05.05 |