Skip to content

Commit f34c875

Browse files
committed
# New sections for the sphinx-example page
1 parent 5467978 commit f34c875

12 files changed

+196
-67
lines changed

docs/source/examples.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ Examples
22
============
33

44
.. toctree::
5-
:caption: Table of Contents
5+
:caption: Examples
66

7-
examples/hello_example
7+
examples/shapes_examples
8+
examples/annotation_examples
89
examples/plots_examples
10+
examples/text_examples
11+
examples/formulas_examples
12+
examples/3d_examples
13+
examples/camera_settings_examples
14+
examples/animation_examples
15+
examples/neat_projects
16+
examples/advanced_projects

docs/source/examples/3d_examples.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
3D Scenes
2+
=================================
3+
4+
.. manim:: Example3DNo1
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class Example3DNo1(ThreeDScene):
9+
def construct(self):
10+
axes = ThreeDAxes()
11+
12+
sphere = ParametricSurface(
13+
lambda u, v: np.array([
14+
1.5 * np.cos(u) * np.cos(v),
15+
1.5 * np.cos(u) * np.sin(v),
16+
1.5 * np.sin(u)
17+
]), v_min=0, v_max=TAU, u_min=-PI / 2, u_max=PI / 2, checkerboard_colors=[RED_D, RED_E],
18+
resolution=(15, 32))
19+
20+
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
21+
22+
self.add(axes, sphere)
23+
24+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Advanced Projects
2+
=================================
3+
4+
.. manim:: Projects1
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class Projects1(Scene):
9+
def construct(self):
10+
t = TextMobject("Some advanced project")
11+
self.add(t)
12+
self.wait(1)
13+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Animations
2+
============
3+
4+
5+
Transformations
6+
#################
7+
8+
Some more examples will come soon here!
9+
10+
Updaters
11+
##########
12+
13+
.. manim:: Updater1Example
14+
:quality: medium
15+
16+
class Updater1Example(Scene):
17+
def construct(self):
18+
curve_reference = Line(ORIGIN, LEFT).set_color(GREEN)
19+
self.add(curve_reference)
20+
21+
def update_curve(mob, dt):
22+
mob.rotate_about_origin(dt)
23+
24+
curve2 = Line(ORIGIN, LEFT)
25+
curve2.add_updater(update_curve)
26+
self.add(curve_reference, curve2)
27+
self.wait(PI)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Annotations
2+
=================================
3+
4+
.. manim:: AnnotateBrace
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class AnnotateBrace(Scene):
9+
def construct(self):
10+
dot = Dot([0, 0, 0])
11+
dot2 = Dot([2, 1, 0])
12+
line = Line(dot.get_center(), dot2.get_center()).set_color(ORANGE)
13+
b1 = Brace(line)
14+
b1text = b1.get_text("Distance")
15+
b2 = Brace(line, direction=line.copy().rotate(PI / 2).get_unit_vector())
16+
b2text = b2.get_tex("x-x_1")
17+
self.add(dot, dot2, line, b1, b2, b1text, b2text)
18+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Camera Settings
2+
=================================
3+
4+
.. manim:: TestZoom1
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class TestZoom1(ZoomedScene):
9+
CONFIG = {
10+
"zoomed_camera_frame_starting_position": [0,0,0],
11+
"zoomed_display_corner": [0,0,0],
12+
"zoomed_display_height": config['frame_height'],
13+
"zoomed_display_width": config['frame_width'],
14+
"zoom_factor": 0.1,
15+
}
16+
def construct(self):
17+
self.activate_zooming(animate=False)
18+
d=Dot()
19+
self.add(d)
20+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Formulas
2+
=================================
3+
4+
.. manim:: Formula1
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class Formula1(Scene):
9+
def construct(self):
10+
t = TexMobject(r"\int_a^b f'(x) dx = f(b)- f(a)")
11+
self.add(t)
12+
self.wait(1)
13+

docs/source/examples/hello_example.rst

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
NeatProjects
2+
=================================
3+
4+
.. manim:: Projects11
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class Projects11(Scene):
9+
def construct(self):
10+
t = TextMobject("Some neat project")
11+
self.add(t)
12+
self.wait(1)
13+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Shapes
2+
=================================
3+
4+
.. manim:: Shape1
5+
:quality: medium
6+
:save_last_frame:
7+
8+
class Shape1(Scene):
9+
def construct(self):
10+
d = Dot()
11+
c = Circle()
12+
s = Square()
13+
t = Triangle()
14+
d.next_to(c,RIGHT)
15+
s.next_to(c,LEFT)
16+
t.next_to(c, DOWN)
17+
self.add(d,c,s,t)
18+
self.wait(1)
19+

0 commit comments

Comments
 (0)