mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Merge cb5ae8964c into 0e83f4b09a
This commit is contained in:
commit
6c2cfefd57
2 changed files with 45 additions and 0 deletions
|
|
@ -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__(
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue