fix(docs): change example to not use LaTeX

This commit is contained in:
Jérome Eertmans
2023-09-06 17:54:17 +02:00
parent 0f5b374bce
commit 9a23296fa2

View File

@ -100,19 +100,23 @@ And later use this class anywhere in your code:
:linenos:
class SubclassExample(MovingCameraSlide):
"""Example taken from ManimCE's docs."""
def construct(self):
eq1 = Text("x", "=", "1")
eq2 = Text("x", "=", "2")
self.camera.frame.save_state()
self.play(Write(eq1))
ax = Axes(x_range=[-1, 10], y_range=[-1, 10])
graph = ax.plot(lambda x: np.sin(x), color=WHITE, x_range=[0, 3 * PI])
dot_1 = Dot(ax.i2gp(graph.t_min, graph))
dot_2 = Dot(ax.i2gp(graph.t_max, graph))
self.add(ax, graph, dot_1, dot_2)
self.play(self.camera.frame.animate.scale(0.5).move_to(dot_1))
self.next_slide()
self.play(
TransformMatchingTex(eq1, eq2),
self.camera.frame.animate.scale(0.5)
)
self.play(self.camera.frame.animate.move_to(dot_2))
self.next_slide()
self.play(Restore(self.camera.frame))
self.wait()
```
@ -135,18 +139,20 @@ directly write the `construct` method in the body of `MovingCameraSlide`.
class SubclassExample(MovingCameraSlide):
def construct(self):
eq1 = Text("x", "=", "1")
eq2 = Text("x", "=", "2")
self.camera.frame.save_state()
self.play(Write(eq1))
ax = Axes(x_range=[-1, 10], y_range=[-1, 10])
graph = ax.plot(lambda x: np.sin(x), color=WHITE, x_range=[0, 3 * PI])
dot_1 = Dot(ax.i2gp(graph.t_min, graph))
dot_2 = Dot(ax.i2gp(graph.t_max, graph))
self.add(ax, graph, dot_1, dot_2)
self.play(self.camera.frame.animate.scale(0.5).move_to(dot_1))
self.next_slide()
self.play(
TransformMatchingTex(eq1, eq2),
self.camera.frame.animate.scale(0.5)
)
self.play(self.camera.frame.animate.move_to(dot_2))
self.next_slide()
self.play(Restore(self.camera.frame))
self.wait()
```