MCPcopy
hub / github.com/ManimCommunity/manim / construct

Method construct

example_scenes/basic.py:19–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

17
18class OpeningManim(Scene):
19 def construct(self):
20 title = Tex(r"This is some \LaTeX")
21 basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
22 VGroup(title, basel).arrange(DOWN)
23 self.play(
24 Write(title),
25 FadeIn(basel, shift=DOWN),
26 )
27 self.wait()
28
29 transform_title = Tex("That was a transform")
30 transform_title.to_corner(UP + LEFT)
31 self.play(
32 Transform(title, transform_title),
33 LaggedStart(*(FadeOut(obj, shift=DOWN) for obj in basel)),
34 )
35 self.wait()
36
37 grid = NumberPlane()
38 grid_title = Tex("This is a grid", font_size=72)
39 grid_title.move_to(transform_title)
40
41 self.add(grid, grid_title) # Make sure title is on top of grid
42 self.play(
43 FadeOut(title),
44 FadeIn(grid_title, shift=UP),
45 Create(grid, run_time=3, lag_ratio=0.1),
46 )
47 self.wait()
48
49 grid_transform_title = Tex(
50 r"That was a non-linear function \\ applied to the grid",
51 )
52 grid_transform_title.move_to(grid_title, UL)
53 grid.prepare_for_nonlinear_transform()
54 self.play(
55 grid.animate.apply_function(
56 lambda p: p
57 + np.array(
58 [
59 np.sin(p[1]),
60 np.sin(p[0]),
61 0,
62 ],
63 ),
64 ),
65 run_time=3,
66 )
67 self.wait()
68 self.play(Transform(grid_title, grid_transform_title))
69 self.wait()
70
71
72class SquareToCircle(Scene):

Callers

nothing calls this directly

Calls 15

TexClass · 0.85
MathTexClass · 0.85
VGroupClass · 0.85
WriteClass · 0.85
FadeInClass · 0.85
TransformClass · 0.85
LaggedStartClass · 0.85
FadeOutClass · 0.85
NumberPlaneClass · 0.85
CreateClass · 0.85
waitMethod · 0.80

Tested by

no test coverage detected