Skip to content

Commit 0f2324f

Browse files
committed
Merge branch 'newExamples' of github.com:MysaaJava/manim into newExamples
2 parents fed1f72 + c1057f3 commit 0f2324f

File tree

7 files changed

+166
-163
lines changed

7 files changed

+166
-163
lines changed

docs/source/examples/3d.rst

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,49 +82,51 @@
8282
.. manim:: ThreeDFunctionPlot
8383

8484
class ThreeDFunctionPlot(ThreeDScene):
85-
8685
def construct(self):
87-
88-
resolution_fa=22
86+
resolution_fa = 22
8987
self.set_camera_orientation(phi=75 * DEGREES, theta=-30 * DEGREES)
9088

91-
def param_plane(u,v):
92-
x=u
93-
y=v
94-
z=0
95-
return np.array([x,y,z])
96-
plane = ParametricSurface( param_plane,
97-
resolution = (resolution_fa,resolution_fa),
98-
v_min = -2,
99-
v_max = +2,
100-
u_min = -2,
101-
u_max = +2 )
102-
plane.scale_about_point(2,ORIGIN)
103-
104-
def param_gauss(u,v):
105-
x=u
106-
y=v
89+
def param_plane(u, v):
90+
x = u
91+
y = v
92+
z = 0
93+
return np.array([x, y, z])
94+
95+
plane = ParametricSurface(
96+
param_plane,
97+
resolution=(resolution_fa, resolution_fa),
98+
v_min=-2,
99+
v_max=+2,
100+
u_min=-2,
101+
u_max=+2,
102+
)
103+
plane.scale_about_point(2, ORIGIN)
104+
105+
def param_gauss(u, v):
106+
x = u
107+
y = v
107108
d = np.sqrt(x * x + y * y)
108109
sigma, mu = 0.4, 0.0
109-
z= np.exp(-((d - mu) ** 2 / (2.0 * sigma ** 2)))
110-
return np.array([x,y,z])
111-
112-
gauss_plane = ParametricSurface( param_gauss,
113-
resolution = (resolution_fa, resolution_fa),
114-
v_min = -2,
115-
v_max = +2,
116-
u_min = -2,
117-
u_max = +2 )
118-
119-
gauss_plane.scale_about_point(2,ORIGIN)
110+
z = np.exp(-((d - mu) ** 2 / (2.0 * sigma ** 2)))
111+
return np.array([x, y, z])
112+
113+
gauss_plane = ParametricSurface(
114+
param_gauss,
115+
resolution=(resolution_fa, resolution_fa),
116+
v_min=-2,
117+
v_max=+2,
118+
u_min=-2,
119+
u_max=+2,
120+
)
121+
122+
gauss_plane.scale_about_point(2, ORIGIN)
120123
gauss_plane.set_style(fill_opacity=1)
121124
gauss_plane.set_style(stroke_color=GREEN)
122-
gauss_plane.set_fill_by_checkerboard(GREEN,BLUE,opacity=0.1)
123-
125+
gauss_plane.set_fill_by_checkerboard(GREEN, BLUE, opacity=0.1)
126+
124127
axes = ThreeDAxes()
125-
128+
126129
self.add(axes)
127130
self.play(Write(plane))
128-
self.play(Transform(plane,gauss_plane))
131+
self.play(Transform(plane, gauss_plane))
129132
self.wait()
130-

docs/source/examples/advanced_projects.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Advanced Projects
1919
transform_title.to_corner(UP + LEFT)
2020
self.play(
2121
Transform(title, transform_title),
22-
LaggedStart(*map(lambda obj: FadeOutAndShift(obj,direction=DOWN), basel)),
22+
LaggedStart(*map(lambda obj: FadeOutAndShift(obj, direction=DOWN), basel)),
2323
)
2424
self.wait()
2525
@@ -31,7 +31,7 @@ Advanced Projects
3131
self.add(grid, grid_title) # Make sure title is on top of grid
3232
self.play(
3333
FadeOut(title),
34-
FadeInFrom(grid_title,direction=DOWN),
34+
FadeInFrom(grid_title, direction=DOWN),
3535
ShowCreation(grid, run_time=3, lag_ratio=0.1),
3636
)
3737
self.wait()

docs/source/examples/animations.rst

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -111,38 +111,33 @@ Updaters
111111
.. manim:: PlaneFadeOut
112112

113113
class PlaneFadeOut(Scene):
114-
115114
def construct(self):
116-
117-
sq2= Square()
118-
119-
sq1= Square()
120-
sq1.next_to(sq2,LEFT)
121-
122-
sq3= Square()
123-
sq3.next_to(sq2,RIGHT)
124-
115+
sq2 = Square()
116+
117+
sq1 = Square()
118+
sq1.next_to(sq2, LEFT)
119+
120+
sq3 = Square()
121+
sq3.next_to(sq2, RIGHT)
122+
125123
circ = Circle()
126-
circ.next_to(sq2,DOWN)
127-
128-
self.add(sq1,sq2,sq3,circ)
124+
circ.next_to(sq2, DOWN)
125+
126+
self.add(sq1, sq2, sq3, circ)
129127
self.wait()
130-
131-
self.play(FadeOut(sq1),FadeOut(sq2),FadeOut(sq3))
128+
129+
self.play(FadeOut(sq1), FadeOut(sq2), FadeOut(sq3))
132130
self.wait()
133131

134132
.. manim:: FadeInAndOut
135133

136134
class FadeInAndOut(Scene):
137135
def construct(self):
138-
square = Square(color=BLUE).shift(2*UP)
139-
140-
annotation = Text('Fade In', height=.8)
136+
square = Square(color=BLUE).shift(2 * UP)
137+
annotation = Text("Fade In", height=0.8)
141138
self.add(annotation)
142139
self.play(FadeIn(square))
143-
144-
annotation.become(Text('Fade Out', height=.8))
140+
141+
annotation.become(Text("Fade Out", height=0.8))
145142
self.add(annotation)
146143
self.play(FadeOut(square))
147-
148-

docs/source/examples/camera_settings.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ so one can use all functionality that were used before in the MovingCameraScene
192192

193193
frame_text.next_to(frame, DOWN)
194194

195-
self.play(ShowCreation(frame), FadeInFrom(frame_text,direction=DOWN))
195+
self.play(ShowCreation(frame), FadeInFrom(frame_text, direction=DOWN))
196196
self.activate_zooming()
197197

198198
self.play(self.get_zoomed_display_pop_out_animation(), unfold_camera)
199199
zoomed_camera_text.next_to(zoomed_display_frame, DOWN)
200-
self.play(FadeInFrom(zoomed_camera_text,direction=DOWN))
200+
self.play(FadeInFrom(zoomed_camera_text, direction=DOWN))
201201
# Scale in x y z
202202
scale_factor = [0.5, 1.5, 0]
203203
self.play(

0 commit comments

Comments
 (0)