@@ -66,6 +66,56 @@ Example using 3D camera. As Manim and ManimGL handle 3D differently, definitions
6666 :end-before: [manimgl-3d]
6767```
6868
69+ ## Subclass Custom Scenes
70+
71+ For compatibility reasons, Manim Slides only provides subclasses for
72+ ` Scene ` and ` ThreeDScene ` .
73+ However, subclassing other scene classes is totally possible,
74+ and very simple to do actually!
75+
76+ [ For example] ( https://github.com/jeertmans/manim-slides/discussions/185 ) ,
77+ you can subclass the ` MovingCameraScene ` class from ` manim `
78+ with the following code:
79+
80+ ``` {code-block} python
81+ :linenos:
82+
83+ from manim import *
84+ from manim_slides import Slide
85+
86+
87+ class MovingCameraSlide(Slide, MovingCameraScene):
88+ pass
89+ ```
90+
91+ And later use this class anywhere in your code:
92+
93+
94+ ``` {code-block} python
95+ :linenos:
96+
97+ class SubclassExample(MovingCameraSlide):
98+ def construct(self):
99+ eq1 = MathTex("x", "=", "1")
100+ eq2 = MathTex("x", "=", "2")
101+
102+ self.play(Write(eq1))
103+
104+ self.next_slide()
105+
106+ self.play(
107+ TransformMatchingTex(eq1, eq2),
108+ self.camera.frame.animate.scale(0.5)
109+ )
110+
111+ self.wait()
112+ ```
113+
114+ :::{note}
115+ If you do not plan to reuse ` MovingCameraSlide ` more than once, then you can
116+ directly write the ` construct ` method in the body of ` MovingCameraSlide ` .
117+ :::
118+
69119## Advanced Example
70120
71121A more advanced example is ` ConvertExample ` , which is used as demo slide and tutorial.
0 commit comments