Examples

Runnable examples for the currently supported feature set. Previews are lazy and only compile when you click Render preview, so opening this page does not trigger a flood of compile requests.

Coverage

Core Objects

  • - Circle, Square, Rectangle, Line, Arrow, Dot, Polygon, RegularPolygon
  • - Text, Tex, MathTex
  • - ImageMobject, SVGMobject
  • - Group and VGroup

Animation Primitives

  • - Create, FadeIn, FadeOut, Write, Unwrite, GrowFromCenter, GrowFromPoint, ShrinkToCenter, Uncreate
  • - Rotate, Shift, MoveTo, Scale, ScaleInPlace
  • - Transform, ReplacementTransform, TransformFromCopy, ClockwiseTransform, CounterclockwiseTransform
  • - MoveToTarget, ApplyMethod, MoveAlongPath, ApplyPointwiseFunction
  • - AnimationGroup, LaggedStart, LaggedStartMap

Scene Features

  • - Camera frame animate, move_camera, zoom_camera
  • - add_fixed_in_frame_mobjects for HUD/static overlays
  • - Updaters via add_updater / clear_updaters
  • - Voiceovers, captions, background audio, image assets
  • - Compilation diagnostics with line and column mapping
Active Section
Transforms
5 visibleOpen cards when needed
Browse one category at a time instead of loading a long mixed gallery.
Transforms

Squares to circles side-by-side

Pair of squares morphing into circles simultaneously.

scene = Scene(fps=60, width=960, height=540)m1a = Square().set_color(RED).shift(LEFT)m1b = Circle().set_color(RED).shift(LEFT)m2a = Square().set_color(BLUE).shift(RIGHT)m2b = Circle().set_color(BLUE).shift(RIGHT)scene.play(Transform(m1a, m1b), Transform(m2a, m2b), run_time=1.2)scene.wait(0.8)
Squares to circles side-by-side preview
Transforms

Transform between shapes

Square to Rectangle with rotation.

scene = Scene(fps=30, width=640, height=360)m1 = Square().set_color(RED)m2 = Rectangle(width=3, height=2).set_color(RED).rotate(0.2)scene.add(m1, m2)scene.play(Transform(m1, m2), run_time=1.5)scene.wait(1)
Transform between shapes preview
Transforms

Triangle to Square

Morph an equilateral triangle into a square.

scene = Scene(fps=60, width=960, height=540)tri = Triangle().set_color(ORANGE).shift(LEFT*1.5)sqr = Square().set_color(ORANGE).shift(LEFT*1.5)scene.add(tri)scene.play(Transform(tri, sqr), run_time=1.2)scene.wait(0.8)
Triangle to Square preview
Transforms

Rounded rectangle to circle

Wide rectangle easing into a circle.

scene = Scene(fps=60, width=960, height=540)rect = Rectangle(width=4, height=2).set_color(TEAL).shift(RIGHT*1.5)circ = Circle().set_color(TEAL).shift(RIGHT*1.5)scene.add(rect)scene.play(Transform(rect, circ), run_time=1.2)scene.wait(0.8)
Rounded rectangle to circle preview
Transforms

Square to circle with rolled points

Compares normal and rolled point-order transforms in parallel.

class ExampleRotation(Scene):    def construct(self):        m1a = Square().set_color(RED).shift(LEFT)        m1b = Circle().set_color(RED).shift(LEFT)        m2a = Square().set_color(BLUE).shift(RIGHT)        m2b = Circle().set_color(BLUE).shift(RIGHT)         points = m2a.points        points = np.roll(points, int(len(points) / 4), axis=0)        m2a.points = points         self.play(Transform(m1a, m1b), Transform(m2a, m2b), run_time=1) scene = ExampleRotation()scene.construct()
Square to circle with rolled points preview