Skip to content

Commit 9a23296

Browse files
committed
fix(docs): change example to not use LaTeX
1 parent 0f5b374 commit 9a23296

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

docs/source/reference/examples.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,23 @@ And later use this class anywhere in your code:
100100
:linenos:
101101
102102
class SubclassExample(MovingCameraSlide):
103-
def construct(self):
104-
eq1 = Text("x", "=", "1")
105-
eq2 = Text("x", "=", "2")
103+
"""Example taken from ManimCE's docs."""
106104
107-
self.play(Write(eq1))
105+
def construct(self):
106+
self.camera.frame.save_state()
108107
109-
self.next_slide()
108+
ax = Axes(x_range=[-1, 10], y_range=[-1, 10])
109+
graph = ax.plot(lambda x: np.sin(x), color=WHITE, x_range=[0, 3 * PI])
110110
111-
self.play(
112-
TransformMatchingTex(eq1, eq2),
113-
self.camera.frame.animate.scale(0.5)
114-
)
111+
dot_1 = Dot(ax.i2gp(graph.t_min, graph))
112+
dot_2 = Dot(ax.i2gp(graph.t_max, graph))
113+
self.add(ax, graph, dot_1, dot_2)
115114
115+
self.play(self.camera.frame.animate.scale(0.5).move_to(dot_1))
116+
self.next_slide()
117+
self.play(self.camera.frame.animate.move_to(dot_2))
118+
self.next_slide()
119+
self.play(Restore(self.camera.frame))
116120
self.wait()
117121
```
118122

@@ -135,18 +139,20 @@ directly write the `construct` method in the body of `MovingCameraSlide`.
135139
136140
class SubclassExample(MovingCameraSlide):
137141
def construct(self):
138-
eq1 = Text("x", "=", "1")
139-
eq2 = Text("x", "=", "2")
142+
self.camera.frame.save_state()
140143
141-
self.play(Write(eq1))
144+
ax = Axes(x_range=[-1, 10], y_range=[-1, 10])
145+
graph = ax.plot(lambda x: np.sin(x), color=WHITE, x_range=[0, 3 * PI])
142146
143-
self.next_slide()
144-
145-
self.play(
146-
TransformMatchingTex(eq1, eq2),
147-
self.camera.frame.animate.scale(0.5)
148-
)
147+
dot_1 = Dot(ax.i2gp(graph.t_min, graph))
148+
dot_2 = Dot(ax.i2gp(graph.t_max, graph))
149+
self.add(ax, graph, dot_1, dot_2)
149150
151+
self.play(self.camera.frame.animate.scale(0.5).move_to(dot_1))
152+
self.next_slide()
153+
self.play(self.camera.frame.animate.move_to(dot_2))
154+
self.next_slide()
155+
self.play(Restore(self.camera.frame))
150156
self.wait()
151157
```
152158

0 commit comments

Comments
 (0)