You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
56 lines
1.6 KiB
3 months ago
|
from manim import *
|
||
|
|
||
|
|
||
|
class OpeningManim(Scene):
|
||
|
def construct(self):
|
||
|
title = Tex(r"This is some \LaTeX")
|
||
|
basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
|
||
|
VGroup(title, basel).arrange(DOWN)
|
||
|
self.play(
|
||
|
Write(title),
|
||
|
FadeIn(basel, shift=DOWN),
|
||
|
)
|
||
|
self.wait()
|
||
|
|
||
|
transform_title = Tex("That was a transform")
|
||
|
transform_title.to_corner(UP + LEFT)
|
||
|
self.play(
|
||
|
Transform(title, transform_title),
|
||
|
LaggedStart(*[FadeOut(obj, shift=DOWN) for obj in basel]),
|
||
|
)
|
||
|
self.wait()
|
||
|
|
||
|
grid = NumberPlane()
|
||
|
grid_title = Tex("This is a grid", font_size=72)
|
||
|
grid_title.move_to(transform_title)
|
||
|
|
||
|
self.add(grid, grid_title) # Make sure title is on top of grid
|
||
|
self.play(
|
||
|
FadeOut(title),
|
||
|
FadeIn(grid_title, shift=UP),
|
||
|
Create(grid, run_time=3, lag_ratio=0.1),
|
||
|
)
|
||
|
self.wait()
|
||
|
|
||
|
grid_transform_title = Tex(
|
||
|
r"That was a non-linear function \\ applied to the grid"
|
||
|
)
|
||
|
grid_transform_title.move_to(grid_title, UL)
|
||
|
grid.prepare_for_nonlinear_transform()
|
||
|
self.play(
|
||
|
grid.animate.apply_function(
|
||
|
lambda p: p
|
||
|
+ np.array(
|
||
|
[
|
||
|
np.sin(p[1]),
|
||
|
np.sin(p[0]),
|
||
|
0,
|
||
|
]
|
||
|
)
|
||
|
),
|
||
|
run_time=3,
|
||
|
)
|
||
|
self.wait()
|
||
|
self.play(Transform(grid_title, grid_transform_title))
|
||
|
self.wait()
|