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
Animations
4 visibleOpen cards when needed
Browse one category at a time instead of loading a long mixed gallery.
Animations

animate method chaining

Animate property setters and transforms.

scene = Scene(fps=30, width=640, height=360)square = Square().set_fill(RED, opacity=1.0)scene.add(square)scene.play(square.animate.set_fill(WHITE), run_time=1)scene.play(square.animate.shift(UP).rotate(PI / 3), run_time=1.5)scene.wait(1)
animate method chaining preview
Animations

FadeIn / Rotate / FadeOut

Core Animation examples.

scene = Scene(fps=30, width=640, height=360)square = Square()scene.play(FadeIn(square))scene.play(Rotate(square, PI / 4))scene.play(FadeOut(square))scene.wait(1)
FadeIn / Rotate / FadeOut preview
Animations

LaggedStart bounce

Three shapes move with a small lag.

scene = Scene(fps=30, width=640, height=360)circle = Circle().shift(LEFT * 2)square = Square().shift(ORIGIN)triangle = Triangle().shift(RIGHT * 2)scene.add(circle, square, triangle)scene.play(    LaggedStart(        circle.animate.shift(UP * 1.5),        square.animate.shift(DOWN * 1.0),        triangle.animate.shift(UP * 1.5),        lag_ratio=0.2    ),    run_time=2,    rate_func=there_and_back)scene.wait(0.5)
LaggedStart bounce preview
Animations

AnimationGroup move_to

Two objects move at the same time with lag_ratio=0.

scene = Scene(fps=30, width=640, height=360)car = Dot(point=LEFT * 4 + UP * 1, color=RED)bus = Dot(point=LEFT * 4 + DOWN * 1, color=BLUE)scene.add(car, bus) car_end_pos = RIGHT * 4 + UP * 1gpu_end_pos_latency = LEFT * 0.5 + DOWN * 1bus_latency_time = 3 scene.play(    AnimationGroup(        car.animate.move_to(car_end_pos),        bus.animate.move_to(gpu_end_pos_latency),        lag_ratio=0    ),    run_time=bus_latency_time,    rate_func=linear)scene.wait(0.5)
AnimationGroup move_to preview