Add a custom style to ArrowTip.

This commit is contained in:
widcardw 2021-04-13 17:40:48 +08:00 committed by GitHub
parent 6b911f5721
commit e727faaccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,6 +49,7 @@ class TipableVMobject(VMobject):
"tip_config": {
"fill_opacity": 1,
"stroke_width": 0,
"tip_look": 1, # triangle=0, inner_smooth=1, dot=2
},
"normal_vector": OUT,
}
@ -786,12 +787,20 @@ class ArrowTip(Triangle):
"width": DEFAULT_ARROW_TIP_WIDTH,
"length": DEFAULT_ARROW_TIP_LENGTH,
"angle": 0,
"tip_look": 1, # triangle=0, inner_smooth=1, dot=2
}
def __init__(self, **kwargs):
Triangle.__init__(self, start_angle=0, **kwargs)
self.set_height(self.width)
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)
def get_base(self):