This commit is contained in:
jaremcukova 2026-06-21 07:00:44 +08:00 committed by GitHub
commit 6c2cfefd57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 45 additions and 0 deletions

View file

@ -195,6 +195,33 @@ class GrowArrow(GrowFromPoint):
self.play(GrowArrow(arrows[0]))
self.play(GrowArrow(arrows[1], point_color=RED))
.. manim :: GrowArrow3DExample
class GrowArrow3DExample(ThreeDScene):
def construct(self):
self.set_camera_orientation(
phi=0 * DEGREES,
theta=90 * DEGREES,
)
arrows = [
Arrow3D(
2 * LEFT,
2 * RIGHT,
thickness=0.05,
color=BLUE,),
Arrow3D(
2 * DR,
2 * UL,
thickness=0.05,
color=RED,
)
]
VGroup(*arrows).set_x(0).arrange(buff=2)
self.wait(0.5)
self.play(GrowArrow(arrows[0]), run_time=2)
self.play(GrowArrow(arrows[1]), run_time=2)
self.wait(1)
"""
def __init__(

View file

@ -1274,6 +1274,24 @@ class Arrow3D(Line3D):
def get_end(self) -> np.ndarray:
return self.end_point.get_center()
def scale(self, factor: float, scale_tips: bool = False, **kwargs: Any) -> Self: # type: ignore[override]
if self.get_length() == 0:
return self
if scale_tips: # if scaling tip scale entire group
super().scale(factor, **kwargs)
return self
# if scaling only shaft
cone = self.cone
self.remove(cone)
super().scale(factor, **kwargs)
self.add(cone)
cone.move_to(self.end_point.get_center())
return self
class Torus(Surface):
"""A torus.