mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Add a custom style to ArrowTip.
This commit is contained in:
parent
6b911f5721
commit
e727faaccb
1 changed files with 9 additions and 0 deletions
|
@ -49,6 +49,7 @@ class TipableVMobject(VMobject):
|
||||||
"tip_config": {
|
"tip_config": {
|
||||||
"fill_opacity": 1,
|
"fill_opacity": 1,
|
||||||
"stroke_width": 0,
|
"stroke_width": 0,
|
||||||
|
"tip_look": 1, # triangle=0, inner_smooth=1, dot=2
|
||||||
},
|
},
|
||||||
"normal_vector": OUT,
|
"normal_vector": OUT,
|
||||||
}
|
}
|
||||||
|
@ -786,12 +787,20 @@ class ArrowTip(Triangle):
|
||||||
"width": DEFAULT_ARROW_TIP_WIDTH,
|
"width": DEFAULT_ARROW_TIP_WIDTH,
|
||||||
"length": DEFAULT_ARROW_TIP_LENGTH,
|
"length": DEFAULT_ARROW_TIP_LENGTH,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
|
"tip_look": 1, # triangle=0, inner_smooth=1, dot=2
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
Triangle.__init__(self, start_angle=0, **kwargs)
|
Triangle.__init__(self, start_angle=0, **kwargs)
|
||||||
self.set_height(self.width)
|
self.set_height(self.width)
|
||||||
self.set_width(self.length, stretch=True)
|
self.set_width(self.length, stretch=True)
|
||||||
|
if self.tip_look == 1:
|
||||||
|
self.set_height(self.length * 0.9, stretch=True)
|
||||||
|
self.data["points"][4] += np.array([0.6 * self.length, 0, 0])
|
||||||
|
elif self.tip_look == 2:
|
||||||
|
h = self.length / 2
|
||||||
|
self.clear_points()
|
||||||
|
self.data["points"] = Dot().set_width(h).get_points()
|
||||||
self.rotate(self.angle)
|
self.rotate(self.angle)
|
||||||
|
|
||||||
def get_base(self):
|
def get_base(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue