반응형
ApplyMethod
arrow = Arrow().to_edge(LEFT)
self.add(arrow)
self.play(ApplyMethod(arrow.to_edge, RIGHT))
self.wait()
ApplyPointwiseFunction Class
def apply_pointwise_function(self):
circle = Circle(radius=0.5)
circle.save_state()
self.add(circle)
self.wait()
self.play(
ApplyPointwiseFunction(
lambda p: 10 * p / get_norm(p),
circle
)
)
self.play(Restore(circle))
circle.set_fill(color=RED, opacity=0.5)
self.play(
ApplyPointwiseFunction(
lambda p: 10 * p / get_norm(p),
circle
)
)
self.wait(2)
ApplyFunction Class
def apply_function(self):
circle = Circle(fill_opacity=1, color=RED).shift(DOWN)
circle.save_state()
self.add(circle)
self.wait()
self.play(
ApplyFunction(
lambda m : m.fade(1).shift(5*DOWN),
circle,
run_time=6,
)
)
self.wait(2)
Homotopy Class
def homotopy(self):
def homotopy_x(x, y, z, t):
alpha = (0.7*x + FRAME_Y_RADIUS)/(FRAME_HEIGHT)
beta = squish_rate_func(smooth, alpha-0.15, alpha+0.15)(t)
return (x - 0.3*np.sin(np.pi*beta), y, z)
def homotopy_y(x, y, z, t):
alpha = (0.7*x + FRAME_X_RADIUS)/(FRAME_WIDTH)
beta = squish_rate_func(smooth, alpha-0.15, alpha+0.15)(t)
return (x, y - 0.3*np.sin(np.pi*beta), z)
text = TextMobject("Homotopy Animation")
circle = Circle()
square = Square()
objs = VGroup(text, circle, square).arrange(RIGHT, buff=1)
self.add(objs)
self.wait()
for i in range(0, 2):
self.play(Homotopy(homotopy_x, objs))
for i in range(0, 2):
self.play(Homotopy(homotopy_y, objs))
self.wait()
PhaseFlow Class
def phase_flow(self):
name_text = Text("PhaseFlow", stroke_width=0, size=0.4, color=YELLOW)
name_text.to_corner(UL)
plane = NumberPlane(color=BLUE_E)
square = Circle(color=YELLOW)
plane.add(square)
self.add(plane, name_text)
self.wait()
def func(t):
return t * 0.1 * RIGHT
self.play(PhaseFlow(
func, plane,
run_time=5,
virtual_time=8,
))
반응형
'Programming > Manim code' 카테고리의 다른 글
[45]Special Effects (0) | 2020.05.29 |
---|---|
[44]AnimationGroup (0) | 2020.05.20 |
[42]Transform (2) (0) | 2020.05.12 |
[41]Transform(1) (0) | 2020.05.12 |
[40]Moving/Rotating (0) | 2020.05.12 |