Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions manim/animation/growing.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,33 @@ def construct(self):
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__(
Expand Down
18 changes: 18 additions & 0 deletions manim/mobject/three_d/three_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,24 @@ def __init__(
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.
Expand Down
Loading