prompt stringlengths 49 5.98k | response stringlengths 93 26.3k | original_prompt stringlengths 7 67 ⌀ | metadata dict |
|---|---|---|---|
Demonstrate how a square's FadeIn animation can be overridden to instead create the shape from scratch. | from manim import *
class MySquare(Square):
@override_animation(FadeIn)
def _fade_in_override(self, **kwargs):
return Create(self, **kwargs)
class OverrideAnimationExample(Scene):
def construct(self):
self.play(FadeIn(MySquare())) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.html",
"original_name": "animation "
} |
Show surrounding rectangle and add three texts over it with Succession animation. | from manim import *
class DefaultAddScene(Scene):
def construct(self):
text_1 = Text("I was added with Add!")
text_2 = Text("Me too!")
text_3 = Text("And me!")
texts = VGroup(text_1, text_2, text_3).arrange(DOWN)
rect = SurroundingRectangle(texts, buff=0.5)
self.pla... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.Add.html",
"original_name": "Add "
} |
Demonstrate the animation of dot groups with varying lag ratios and vertical shifts, displaying corresponding text labels. | from manim import *
class LagRatios(Scene):
def construct(self):
ratios = [0, 0.1, 0.5, 1, 2] # demonstrated lag_ratios
# Create dot groups
group = VGroup(*[Dot() for _ in range(4)]).arrange_submobjects()
groups = VGroup(*[group.copy() for _ in ratios]).arrange_submobjects(buff=1)... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.Animation.html",
"original_name": "Animation "
} |
Demonstrate how to create a square that simultaneously fades in and appears. | from manim import *
class MySquare(Square):
@override_animation(FadeIn)
def _fade_in_override(self, **kwargs):
return Create(self, **kwargs)
class OverrideAnimationExample(Scene):
def construct(self):
self.play(FadeIn(MySquare())) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.html#manim.animation.animation.override_animation",
"original_name": "animation "
} |
Demonstrate a square animation with a fade-in effect. | from manim import *
class MySquare(Square):
@override_animation(FadeIn)
def _fade_in_override(self, **kwargs):
return Create(self, **kwargs)
class OverrideAnimationExample(Scene):
def construct(self):
self.play(FadeIn(MySquare())) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.html#manim.animation.animation.prepare_animation",
"original_name": "animation "
} |
Demonstrate a visually animated boundary effect on a rotating colored text element. | from manim import *
class AnimatedBoundaryExample(Scene):
def construct(self):
text = Text("So shiny!")
boundary = AnimatedBoundary(text, colors=[RED, GREEN, BLUE],
cycle_rate=3)
self.add(text, boundary)
self.wait(2) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.changing.AnimatedBoundary.html",
"original_name": "AnimatedBoundary "
} |
Demonstrate a red circle tracing its path as it rolls to the right, with a fixed dot following along. | from manim import *
class TracedPathExample(Scene):
def construct(self):
circ = Circle(color=RED).shift(4*LEFT)
dot = Dot(color=RED).move_to(circ.get_start())
rolling_circle = VGroup(circ, dot)
trace = TracedPath(circ.get_start)
rolling_circle.add_updater(lambda m: m.rotate(... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.changing.TracedPath.html",
"original_name": "TracedPath "
} |
Demonstrate a scene with dots moving in sync, labeled "25%", while showing smooth lagged start animation. | from manim import *
class LaggedStartExample(Scene):
def construct(self):
title = Text("lag_ratio = 0.25").to_edge(UP)
dot1 = Dot(point=LEFT * 2 + UP, radius=0.16)
dot2 = Dot(point=LEFT * 2, radius=0.16)
dot3 = Dot(point=LEFT * 2 + DOWN, radius=0.16)
line_25 = DashedLine(
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.composition.LaggedStart.html",
"original_name": "LaggedStart "
} |
Create a 5x7 grid of dots and title text, then show a lagged yellow ripple effect animation. | from manim import *
class LaggedStartMapExample(Scene):
def construct(self):
title = Tex("LaggedStartMap").to_edge(UP, buff=LARGE_BUFF)
dots = VGroup(
*[Dot(radius=0.16) for _ in range(35)]
).arrange_in_grid(rows=5, cols=7, buff=MED_LARGE_BUFF)
self.add(dots, title)
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.composition.LaggedStartMap.html",
"original_name": "LaggedStartMap "
} |
Demonstrate the movement of four dots around a square shape in a Manim animation, showcasing their successive transitions. | from manim import *
class SuccessionExample(Scene):
def construct(self):
dot1 = Dot(point=LEFT * 2 + UP * 2, radius=0.16, color=BLUE)
dot2 = Dot(point=LEFT * 2 + DOWN * 2, radius=0.16, color=MAROON)
dot3 = Dot(point=RIGHT * 2 + DOWN * 2, radius=0.16, color=GREEN)
dot4 = Dot(point=RI... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.composition.Succession.html",
"original_name": "Succession "
} |
Demonstrate the creation of a square using the Manim animation library. | from manim import *
class CreateScene(Scene):
def construct(self):
self.play(Create(Square())) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.Create.html",
"original_name": "Create "
} |
Demonstrate a square drawing itself with a border that then fills in fully. | from manim import *
class ShowDrawBorderThenFill(Scene):
def construct(self):
self.play(DrawBorderThenFill(Square(fill_opacity=1, fill_color=ORANGE))) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.DrawBorderThenFill.html",
"original_name": "DrawBorderThenFill "
} |
Demonstrate increasing subsets of geometric shapes (dot, square, triangle) in a seamless animation. | from manim import *
class ShowIncreasingSubsetsScene(Scene):
def construct(self):
p = VGroup(Dot(), Square(), Triangle())
self.add(p)
self.play(ShowIncreasingSubsets(p))
self.wait() | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.ShowIncreasingSubsets.html",
"original_name": "ShowIncreasingSubsets "
} |
Demonstrate a spiral animation that moves in towards a group of three shapes. | from manim import *
class SpiralInExample(Scene):
def construct(self):
pi = MathTex(r"\pi").scale(7)
pi.shift(2.25 * LEFT + 1.5 * UP)
circle = Circle(color=GREEN_C, fill_opacity=1).shift(LEFT)
square = Square(color=BLUE_D, fill_opacity=1).shift(UP)
shapes = VGroup(pi, circle... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.SpiralIn.html",
"original_name": "SpiralIn "
} |
Demonstrate inserting text with a cursor that blinks and highlights with purple color. | from manim import *
class InsertingTextExample(Scene):
def construct(self):
text = Text("Inserting", color=PURPLE).scale(1.5).to_edge(LEFT)
cursor = Rectangle(
color = GREY_A,
fill_color = GREY_A,
fill_opacity = 1.0,
height = 1.1,
width = ... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.TypeWithCursor.html",
"original_name": "TypeWithCursor "
} |
Create a visual representation of an object (a square) being uncreated, implying its disappearance. | from manim import *
class ShowUncreate(Scene):
def construct(self):
self.play(Uncreate(Square())) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.Uncreate.html",
"original_name": "Uncreate "
} |
Create a scene demonstrating text with a moving cursor that blinks and appears to be deleted by changing its opacity. | from manim import *
class DeletingTextExample(Scene):
def construct(self):
text = Text("Deleting", color=PURPLE).scale(1.5).to_edge(LEFT)
cursor = Rectangle(
color = GREY_A,
fill_color = GREY_A,
fill_opacity = 1.0,
height = 1.1,
width = 0.... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.UntypeWithCursor.html",
"original_name": "UntypeWithCursor "
} |
Demonstrate a reversible unwrapping of a scaled text label. | from manim import *
class UnwriteReverseTrue(Scene):
def construct(self):
text = Tex("Alice and Bob").scale(3)
self.add(text)
self.play(Unwrite(text)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.Unwrite.html",
"original_name": "Unwrite "
} |
Demonstrate a large, bold "Hello" text appearing on screen. | from manim import *
class ShowWrite(Scene):
def construct(self):
self.play(Write(Text("Hello", font_size=144))) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.creation.Write.html",
"original_name": "Write "
} |
Demonstrate a fade-in and out animation of two texts, shifting and scaling them horizontally over time. | from manim import *
class Fading(Scene):
def construct(self):
tex_in = Tex("Fade", "In").scale(3)
tex_out = Tex("Fade", "Out").scale(3)
self.play(FadeIn(tex_in, shift=DOWN, scale=0.66))
self.play(ReplacementTransform(tex_in, tex_out))
self.play(FadeOut(tex_out, shift=DOWN * ... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.fading.html",
"original_name": "fading "
} |
Demonstrate a group animation that fades in multiple elements with varying transformations (shift, target position, and scale) on the screen simultaneously. | from manim import *
class FadeInExample(Scene):
def construct(self):
dot = Dot(UP * 2 + LEFT)
self.add(dot)
tex = Tex(
"FadeIn with ", "shift ", r" or target\_position", " and scale"
).scale(1)
animations = [
FadeIn(tex[0]),
FadeIn(tex[1],... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.fading.FadeIn.html",
"original_name": "FadeIn "
} |
Demonstrate the animation of a dot fading in and out while applying various transformations such as shift, target position, and scale over time. | from manim import *
class FadeInExample(Scene):
def construct(self):
dot = Dot(UP * 2 + LEFT)
self.add(dot)
tex = Tex(
"FadeOut with ", "shift ", r" or target\_position", " and scale"
).scale(1)
animations = [
FadeOut(tex[0]),
FadeOut(tex[... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.fading.FadeOut.html",
"original_name": "FadeOut "
} |
Demonstrate the growth of various shapes and objects from different directions in a scene. | from manim import *
class Growing(Scene):
def construct(self):
square = Square()
circle = Circle()
triangle = Triangle()
arrow = Arrow(LEFT, RIGHT)
star = Star()
VGroup(square, circle, triangle).set_x(0).arrange(buff=1.5).set_y(2)
VGroup(arrow, star).move_to... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.growing.html",
"original_name": "growing "
} |
Create a growing animation of two arrows, one stretching from left to right and the other from bottom left to top right, with the second arrow displayed in red. | from manim import *
class GrowArrowExample(Scene):
def construct(self):
arrows = [Arrow(2 * LEFT, 2 * RIGHT), Arrow(2 * DR, 2 * UL)]
VGroup(*arrows).set_x(0).arrange(buff=2)
self.play(GrowArrow(arrows[0]))
self.play(GrowArrow(arrows[1], point_color=RED)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.growing.GrowArrow.html",
"original_name": "GrowArrow "
} |
Demonstrate a square growing from the center, with one square changing color upon growth. | from manim import *
class GrowFromCenterExample(Scene):
def construct(self):
squares = [Square() for _ in range(2)]
VGroup(*squares).set_x(0).arrange(buff=2)
self.play(GrowFromCenter(squares[0]))
self.play(GrowFromCenter(squares[1], point_color=RED)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.growing.GrowFromCenter.html",
"original_name": "GrowFromCenter "
} |
Demonstrate a 4-square grid growing from its edges in alternating directions. | from manim import *
class GrowFromEdgeExample(Scene):
def construct(self):
squares = [Square() for _ in range(4)]
VGroup(*squares).set_x(0).arrange(buff=1)
self.play(GrowFromEdge(squares[0], DOWN))
self.play(GrowFromEdge(squares[1], RIGHT))
self.play(GrowFromEdge(squares[2],... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.growing.GrowFromEdge.html",
"original_name": "GrowFromEdge "
} |
Demonstrate a geometric figure (four squares) growing from specific points with varying colors. | from manim import *
class GrowFromPointExample(Scene):
def construct(self):
dot = Dot(3 * UR, color=GREEN)
squares = [Square() for _ in range(4)]
VGroup(*squares).set_x(0).arrange(buff=1)
self.add(dot)
self.play(GrowFromPoint(squares[0], ORIGIN))
self.play(GrowFromPo... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.growing.GrowFromPoint.html",
"original_name": "GrowFromPoint "
} |
Demonstrate the animation of three squares spinning into view with varying color and rotation. | from manim import *
class SpinInFromNothingExample(Scene):
def construct(self):
squares = [Square() for _ in range(3)]
VGroup(*squares).set_x(0).arrange(buff=2)
self.play(SpinInFromNothing(squares[0]))
self.play(SpinInFromNothing(squares[1], angle=2 * PI))
self.play(SpinInFr... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.growing.SpinInFromNothing.html",
"original_name": "SpinInFromNothing "
} |
Demonstrate a sequence of animations showcasing 7 visual effects, transitioning between each by fading out and fading in subsequent elements with slight vertical shifts. | from manim import *
class Indications(Scene):
def construct(self):
indications = [ApplyWave,Circumscribe,Flash,FocusOn,Indicate,ShowPassingFlash,Wiggle]
names = [Tex(i.__name__).scale(3) for i in indications]
self.add(names[0])
for i in range(len(names)):
if indications... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.html",
"original_name": "indication "
} |
Demonstrate wave motion on a single text element, with varying speed and ripple effects. | from manim import *
class ApplyingWaves(Scene):
def construct(self):
tex = Tex("WaveWaveWaveWaveWave").scale(2)
self.play(ApplyWave(tex))
self.play(ApplyWave(
tex,
direction=RIGHT,
time_width=0.5,
amplitude=0.3
))
self.play(App... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.ApplyWave.html",
"original_name": "ApplyWave "
} |
Create a scene with a large, blinking text label that switches between visibility in 3 successive intervals. | from manim import *
class BlinkingExample(Scene):
def construct(self):
text = Text("Blinking").scale(1.5)
self.add(text)
self.play(Blink(text, blinks=3)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.Blink.html",
"original_name": "Blink "
} |
Create a 2x scaled label with the text "Circum-scribe" and demonstrate its transformation into a circle. | from manim import *
class UsingCircumscribe(Scene):
def construct(self):
lbl = Tex(r"Circum-\\scribe").scale(2)
self.add(lbl)
self.play(Circumscribe(lbl))
self.play(Circumscribe(lbl, Circle))
self.play(Circumscribe(lbl, fade_out=True))
self.play(Circumscribe(lbl, tim... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.Circumscribe.html",
"original_name": "Circumscribe "
} |
Create a flash animation that moves a yellow dot downwards. | from manim import *
class UsingFlash(Scene):
def construct(self):
dot = Dot(color=YELLOW).shift(DOWN)
self.add(Tex("Flash the dot below:"), dot)
self.play(Flash(dot))
self.wait() | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.Flash.html",
"original_name": "Flash "
} |
Create a visual focus effect on a yellow dot that moves downward. | from manim import *
class UsingFocusOn(Scene):
def construct(self):
dot = Dot(color=YELLOW).shift(DOWN)
self.add(Tex("Focusing on the dot below:"), dot)
self.play(FocusOn(dot))
self.wait() | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.FocusOn.html",
"original_name": "FocusOn "
} |
Demonstrate a highlighted text box using the Indicate animation, scaling it to 3 times its size. | from manim import *
class UsingIndicate(Scene):
def construct(self):
tex = Tex("Indicate").scale(3)
self.play(Indicate(tex))
self.wait() | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.Indicate.html",
"original_name": "Indicate "
} |
Create a visual demonstration of different time widths, transitioning between colored polygons and labeled text. | from manim import *
class TimeWidthValues(Scene):
def construct(self):
p = RegularPolygon(5, color=DARK_GRAY, stroke_width=6).scale(3)
lbl = VMobject()
self.add(p, lbl)
p = p.copy().set_color(BLUE)
for time_width in [0.2, 0.5, 1, 2]:
lbl.become(Tex(r"\texttt{time... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.ShowPassingFlash.html",
"original_name": "ShowPassingFlash "
} |
Demonstrate a wiggling animation of the text "Wiggle" scaled up to 3 units. | from manim import *
class ApplyingWaves(Scene):
def construct(self):
tex = Tex("Wiggle").scale(3)
self.play(Wiggle(tex))
self.wait() | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.indication.Wiggle.html",
"original_name": "Wiggle "
} |
Create a visual demonstration of a 3D square that smoothly translates and oscillates along the Y-axis over time. | from manim import *
class HomotopyExample(Scene):
def construct(self):
square = Square()
def homotopy(x, y, z, t):
if t <= 0.25:
progress = t / 0.25
return (x, y + progress * 0.2 * np.sin(x), z)
else:
wave_progress = (t - 0.25... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.movement.Homotopy.html",
"original_name": "Homotopy "
} |
Create a Manim animation demonstrating the movement of an orange dot along a line path while maintaining its color. | from manim import *
class MoveAlongPathExample(Scene):
def construct(self):
d1 = Dot().set_color(ORANGE)
l1 = Line(LEFT, RIGHT)
l2 = VMobject()
self.add(d1, l1, l2)
l2.add_updater(lambda x: x.become(Line(LEFT, d1.get_center()).set_color(ORANGE)))
self.play(MoveAlongP... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.movement.MoveAlongPath.html",
"original_name": "MoveAlongPath "
} |
Show a rotating square animation with smooth motion around its center point. | from manim import *
class UsingRotate(Scene):
def construct(self):
self.play(
Rotate(
Square(side_length=0.5).shift(UP * 2),
angle=2*PI,
about_point=ORIGIN,
rate_func=linear,
),
Rotate(Square(side_length=0.5... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.rotation.Rotate.html",
"original_name": "Rotate "
} |
Show a teal circle being broadcasted across the screen with smooth animation. | from manim import *
class BroadcastExample(Scene):
def construct(self):
mob = Circle(radius=4, color=TEAL_A)
self.play(Broadcast(mob)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.specialized.Broadcast.html",
"original_name": "Broadcast "
} |
Demonstrate the animation of two dots moving at different speeds along a horizontal axis, with a smooth transition between them. | from manim import *
class SpeedModifierExample(Scene):
def construct(self):
a = Dot().shift(LEFT * 4)
b = Dot().shift(RIGHT * 4)
self.add(a, b)
self.play(
ChangeSpeed(
AnimationGroup(
a.animate(run_time=1).shift(RIGHT * 8),
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.speedmodifier.ChangeSpeed.html",
"original_name": "ChangeSpeed "
} |
Demonstrate the application of a 2x2 transformation matrix to display text and a coordinate plane with scaling. | from manim import *
class ApplyMatrixExample(Scene):
def construct(self):
matrix = [[1, 1], [0, 2/3]]
self.play(ApplyMatrix(matrix, Text("Hello World!")), ApplyMatrix(matrix, NumberPlane())) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.ApplyMatrix.html",
"original_name": "ApplyMatrix "
} |
Demonstrate a 2D square warping into a 3D cube by transforming its points along the z-axis. | from manim import *
class WarpSquare(Scene):
def construct(self):
square = Square()
self.play(
ApplyPointwiseFunction(
lambda point: complex_to_R3(np.exp(R3_to_complex(point))), square
)
)
self.wait() | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.ApplyPointwiseFunction.html",
"original_name": "ApplyPointwiseFunction "
} |
Create a transformation sequence showing two squares rotating clockwise around the dots. | from manim import *
class ClockwiseExample(Scene):
def construct(self):
dl, dr = Dot(), Dot()
sl, sr = Square(), Square()
VGroup(dl, sl).arrange(DOWN).shift(2*LEFT)
VGroup(dr, sr).arrange(DOWN).shift(2*RIGHT)
self.add(dl, dr)
self.wait()
self.play(
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.ClockwiseTransform.html",
"original_name": "ClockwiseTransform "
} |
Demonstrate the transformation of two numbers with a counterclockwise and clockwise motion, scaling their texts. | from manim import *
class CounterclockwiseTransform_vs_Transform(Scene):
def construct(self):
# set up the numbers
c_transform = VGroup(DecimalNumber(number=3.141, num_decimal_places=3), DecimalNumber(number=1.618, num_decimal_places=3))
text_1 = Text("CounterclockwiseTransform", color=RED)... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.CounterclockwiseTransform.html",
"original_name": "CounterclockwiseTransform "
} |
Create a rotating, cyclic animation of shapes (square, circle, triangle, star) by replacing each shape with the next one. | from manim import *
class CyclicReplaceExample(Scene):
def construct(self):
group = VGroup(Square(), Circle(), Triangle(), Star())
group.arrange(RIGHT)
self.add(group)
for _ in range(4):
self.play(CyclicReplace(*group)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.CyclicReplace.html",
"original_name": "CyclicReplace "
} |
Demonstrate a simple animation where text fades to red. | from manim import *
class FadeToColorExample(Scene):
def construct(self):
self.play(FadeToColor(Text("Hello World!"), color=RED)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.FadeToColor.html",
"original_name": "FadeToColor "
} |
Demonstrate a series of transformations involving fading and scaling of rectangles to circles with varying opacity and scale. | from manim import *
class DifferentFadeTransforms(Scene):
def construct(self):
starts = [Rectangle(width=4, height=1) for _ in range(3)]
VGroup(*starts).arrange(DOWN, buff=1).shift(3*LEFT)
targets = [Circle(fill_opacity=1).scale(0.25) for _ in range(3)]
VGroup(*targets).arrange(DOWN... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.FadeTransform.html",
"original_name": "FadeTransform "
} |
Demonstrate the transformation of two groups of shapes with fading and sliding motions. | from manim import *
class FadeTransformSubmobjects(Scene):
def construct(self):
src = VGroup(Square(), Circle().shift(LEFT + UP))
src.shift(3*LEFT + 2*UP)
src_copy = src.copy().shift(4*DOWN)
target = VGroup(Circle(), Triangle().shift(RIGHT + DOWN))
target.shift(3*RIGHT + 2*... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.FadeTransformPieces.html",
"original_name": "FadeTransformPieces "
} |
Create a green circle that smoothly moves to its target position, scaling down and shifting slightly along the way. | from manim import *
class MoveToTargetExample(Scene):
def construct(self):
c = Circle()
c.generate_target()
c.target.set_fill(color=GREEN, opacity=0.5)
c.target.shift(2*RIGHT + UP).scale(0.5)
self.add(c)
self.play(MoveToTarget(c)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.MoveToTarget.html",
"original_name": "MoveToTarget "
} |
Create a Manim animation that shows two groups of integers (one labeled "ReplacementTransform" and one labeled "Transform") replacing each other, with the second group lingering after the transformation. | from manim import *
class ReplacementTransformOrTransform(Scene):
def construct(self):
# set up the numbers
r_transform = VGroup(*[Integer(i) for i in range(1,4)])
text_1 = Text("ReplacementTransform", color=RED)
r_transform.add(text_1)
transform = VGroup(*[Integer(i) for i... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.ReplacementTransform.html",
"original_name": "ReplacementTransform "
} |
Demonstrate a square transforming into its original state over time, with a fade-in and fade-out effect. | from manim import *
class RestoreExample(Scene):
def construct(self):
s = Square()
s.save_state()
self.play(FadeIn(s))
self.play(s.animate.set_color(PURPLE).set_opacity(0.5).shift(2*LEFT).scale(3))
self.play(s.animate.shift(5*DOWN).rotate(PI/4))
self.wait()
s... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.Restore.html",
"original_name": "Restore "
} |
Show a "Hello World!" text scaling in place from its original size to twice its original size. | from manim import *
class ScaleInPlaceExample(Scene):
def construct(self):
self.play(ScaleInPlace(Text("Hello World!"), 2)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.ScaleInPlace.html",
"original_name": "ScaleInPlace "
} |
Demonstrate text shrinking to the center of the screen. | from manim import *
class ShrinkToCenterExample(Scene):
def construct(self):
self.play(ShrinkToCenter(Text("Hello World!"))) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.ShrinkToCenter.html",
"original_name": "ShrinkToCenter "
} |
Demonstrate colorful circles rotating around each other with smoothly animated arcs. | from manim import *
class TransformPathArc(Scene):
def construct(self):
def make_arc_path(start, end, arc_angle):
points = []
p_fn = path_along_arc(arc_angle)
# alpha animates between 0.0 and 1.0, where 0.0
# is the beginning of the animation and 1.0 is the e... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform.Transform.html",
"original_name": "Transform "
} |
Demonstrate an anagram transformation between two Morse code sequences using a text-to-text animation with a circular overlap. | from manim import *
class Anagram(Scene):
def construct(self):
src = Text("the morse code")
tar = Text("here come dots")
self.play(Write(src))
self.wait(0.5)
self.play(TransformMatchingShapes(src, tar, path_arc=PI/2))
self.wait(0.5) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform_matching_parts.TransformMatchingShapes.html",
"original_name": "TransformMatchingShapes "
} |
Demonstrate transformation of equations by superimposing variables, showcasing match and substitution changes with animations. | from manim import *
class MatchingEquationParts(Scene):
def construct(self):
variables = VGroup(MathTex("a"), MathTex("b"), MathTex("c")).arrange_submobjects().shift(UP)
eq1 = MathTex("{{x}}^2", "+", "{{y}}^2", "=", "{{z}}^2")
eq2 = MathTex("{{a}}^2", "+", "{{b}}^2", "=", "{{c}}^2")
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.animation.transform_matching_parts.TransformMatchingTex.html",
"original_name": "TransformMatchingTex "
} |
Demonstrate a dynamic graph with moving vertices and edges. | from manim import *
class MovingDiGraph(Scene):
def construct(self):
vertices = [1, 2, 3, 4]
edges = [(1, 2), (2, 3), (3, 4), (1, 3), (1, 4)]
g = DiGraph(vertices, edges)
self.add(g)
self.play(
g[1].animate.move_to([1, 1, 1]),
g[2].animate.move_to([... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.graph.DiGraph.html",
"original_name": "DiGraph "
} |
Demonstrate a graph with initial layout and transform its structure to a circular layout. | from manim import *
class ChangeGraphLayout(Scene):
def construct(self):
G = Graph([1, 2, 3, 4, 5], [(1, 2), (2, 3), (3, 4), (4, 5)],
layout={1: [-2, 0, 0], 2: [-1, 0, 0], 3: [0, 0, 0],
4: [1, 0, 0], 5: [2, 0, 0]}
)
self.play(Create(G))
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.graph.GenericGraph.html",
"original_name": "GenericGraph "
} |
Show a square grid of moving vertices on an axis. | from manim import *
class MovingVertices(Scene):
def construct(self):
vertices = [1, 2, 3, 4]
edges = [(1, 2), (2, 3), (3, 4), (1, 3), (1, 4)]
g = Graph(vertices, edges)
self.play(Create(g))
self.wait()
self.play(g[1].animate.move_to([1, 1, 0]),
g[2... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.graph.Graph.html",
"original_name": "Graph "
} |
Show a graph with custom layout, displaying nodes in a staggered pattern across the screen. | from manim import *
class CustomLayoutExample(Scene):
def construct(self):
import numpy as np
import networkx as nx
# create custom layout
def custom_layout(
graph: nx.Graph,
scale: float | tuple[float, float, float] = 2,
n: int | None = None,
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.graph.LayoutFunction.html",
"original_name": "LayoutFunction "
} |
Create a visually striking dark-themed banner that expands and then disappears. | from manim import *
class DarkThemeBanner(Scene):
def construct(self):
banner = ManimBanner()
self.play(banner.create())
self.play(banner.expand())
self.wait()
self.play(Unwrite(banner)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.logo.ManimBanner.html",
"original_name": "ManimBanner "
} |
Demonstrate a grid arrangement of matrices and Mobjects with various visual elements, including circles, squares, math symbols, and stars. | from manim import *
class MatrixExamples(Scene):
def construct(self):
m0 = Matrix([["\\pi", 0], [-1, 1]])
m1 = IntegerMatrix([[1.5, 0.], [12, -1.3]],
left_bracket="(",
right_bracket=")")
m2 = DecimalMatrix(
[[3.456, 2.122], [33.2244, 12.33]],
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.html",
"original_name": "matrix "
} |
Demonstrate a DecimalMatrix with rounded numbers using curly brackets and precise formatting. | from manim import *
class DecimalMatrixExample(Scene):
def construct(self):
m0 = DecimalMatrix(
[[3.456, 2.122], [33.2244, 12]],
element_to_mobject_config={"num_decimal_places": 2},
left_bracket="\\{",
right_bracket="\\}")
self.add(m0) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.DecimalMatrix.html",
"original_name": "DecimalMatrix "
} |
Create a visual representation of an integer matrix with rounded numbers and boxed border.
Or:
Show an example of an integer matrix with precise decimal values in a bordered display. | from manim import *
class IntegerMatrixExample(Scene):
def construct(self):
m0 = IntegerMatrix(
[[3.7, 2], [42.2, 12]],
left_bracket="(",
right_bracket=")")
self.add(m0) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.IntegerMatrix.html",
"original_name": "IntegerMatrix "
} |
Create a grid of six matrices with various transformations and colorings, showcasing different alignments and brackets. | from manim import *
class MatrixExamples(Scene):
def construct(self):
m0 = Matrix([[2, r"\pi"], [-1, 1]])
m1 = Matrix([[2, 0, 4], [-1, 1, 5]],
v_buff=1.3,
h_buff=0.8,
bracket_h_buff=SMALL_BUFF,
bracket_v_buff=SMALL_BUFF,
left_bracket=r"\{"... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.Matrix.html",
"original_name": "Matrix "
} |
Demonstrate a 2x2 matrix layout with Circle, Square, and MathTex elements, using Manim's MobjectMatrix. | from manim import *
class MobjectMatrixExample(Scene):
def construct(self):
a = Circle().scale(0.3)
b = Square().scale(0.3)
c = MathTex("\\pi").scale(2)
d = Star().scale(0.3)
m0 = MobjectMatrix([[a, b], [c, d]])
self.add(m0) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.MobjectMatrix.html",
"original_name": "MobjectMatrix "
} |
Demonstrate creation of matrices with various visual elements, including integers, decimals, and custom shapes. | from manim import *
class MatrixExamples(Scene):
def construct(self):
m0 = Matrix([["\\pi", 0], [-1, 1]])
m1 = IntegerMatrix([[1.5, 0.], [12, -1.3]],
left_bracket="(",
right_bracket=")")
m2 = DecimalMatrix(
[[3.456, 2.122], [33.2244, 12.33]],
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.html#manim.mobject.matrix.get_det_text",
"original_name": "matrix "
} |
Demonstrate a group of matrices and 3D objects in a grid layout. | from manim import *
class MatrixExamples(Scene):
def construct(self):
m0 = Matrix([["\\pi", 0], [-1, 1]])
m1 = IntegerMatrix([[1.5, 0.], [12, -1.3]],
left_bracket="(",
right_bracket=")")
m2 = DecimalMatrix(
[[3.456, 2.122], [33.2244, 12.33]],
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.html#manim.mobject.matrix.matrix_to_mobject",
"original_name": "matrix "
} |
Create a visual representation of mathematical matrices with various formatting options and display in a grid layout. | from manim import *
class MatrixExamples(Scene):
def construct(self):
m0 = Matrix([["\\pi", 0], [-1, 1]])
m1 = IntegerMatrix([[1.5, 0.], [12, -1.3]],
left_bracket="(",
right_bracket=")")
m2 = DecimalMatrix(
[[3.456, 2.122], [33.2244, 12.33]],
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.matrix.html#manim.mobject.matrix.matrix_to_tex_string",
"original_name": "matrix "
} |
Create a circle with text content and demonstrate its clear animation, revealing a blank space. | from manim import *
class CircleWithContent(VGroup):
def __init__(self, content):
super().__init__()
self.circle = Circle()
self.content = content
self.add(self.circle, content)
content.move_to(self.circle.get_center())
def clear_content(self):
self.remove(self.... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.mobject.html",
"original_name": "mobject "
} |
Create a circle with animated text content, demonstrating circle creation and content removal. | from manim import *
class CircleWithContent(VGroup):
def __init__(self, content):
super().__init__()
self.circle = Circle()
self.content = content
self.add(self.circle, content)
content.move_to(self.circle.get_center())
def clear_content(self):
self.remove(self.... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.mobject.html#manim.mobject.mobject.TimeBasedUpdater",
"original_name": "mobject "
} |
Create a visual example demonstrating the creation and removal of animated circle with content, showcasing circle transformations and text overlay. | from manim import *
class CircleWithContent(VGroup):
def __init__(self, content):
super().__init__()
self.circle = Circle()
self.content = content
self.add(self.circle, content)
content.move_to(self.circle.get_center())
def clear_content(self):
self.remove(self.... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.mobject.html#manim.mobject.mobject.NonTimeBasedUpdater",
"original_name": "mobject "
} |
"Show a circle with text content that fades away over time." | from manim import *
class CircleWithContent(VGroup):
def __init__(self, content):
super().__init__()
self.circle = Circle()
self.content = content
self.add(self.circle, content)
content.move_to(self.circle.get_center())
def clear_content(self):
self.remove(self.... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.mobject.html#manim.mobject.mobject.Updater",
"original_name": "mobject "
} |
Create an animated dot that rotates around its center point. | from manim import *
class NextToUpdater(Scene):
def construct(self):
def dot_position(mobject):
mobject.set_value(dot.get_center()[0])
mobject.next_to(dot)
dot = Dot(RIGHT*3)
label = DecimalNumber()
label.add_updater(dot_position)
self.add(dot, label... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.mobject.Mobject.html",
"original_name": "Mobject "
} |
"Create and animate a circle with content, demonstrating clear animation and transformation over time." | from manim import *
class CircleWithContent(VGroup):
def __init__(self, content):
super().__init__()
self.circle = Circle()
self.content = content
self.add(self.circle, content)
content.move_to(self.circle.get_center())
def clear_content(self):
self.remove(self.... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.mobject.html#manim.mobject.mobject.override_animate",
"original_name": "mobject "
} |
Demonstrate a visual comparison of two tables with different data types and layouts, featuring highlighted cells, color-coded lines, and interactive crosshairs. | from manim import *
class TableExamples(Scene):
def construct(self):
t0 = Table(
[["First", "Second"],
["Third","Fourth"]],
row_labels=[Text("R1"), Text("R2")],
col_labels=[Text("C1"), Text("C2")],
top_left_entry=Text("TOP"))
t0.add_highli... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.table.html",
"original_name": "table "
} |
Create a decimal table displaying the exponential function f(x) = e^x, with rounded values. | from manim import *
class DecimalTableExample(Scene):
def construct(self):
x_vals = [-2,-1,0,1,2]
y_vals = np.exp(x_vals)
t0 = DecimalTable(
[x_vals, y_vals],
row_labels=[MathTex("x"), MathTex("f(x)=e^{x}")],
h_buff=1,
element_to_mobject_confi... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.table.DecimalTable.html",
"original_name": "DecimalTable "
} |
Demonstrate a rotating table showing angles and trigonometric values from 0 to π/2 radians. | from manim import *
class IntegerTableExample(Scene):
def construct(self):
t0 = IntegerTable(
[[0,30,45,60,90],
[90,60,45,30,0]],
col_labels=[
MathTex(r"\frac{\sqrt{0}}{2}"),
MathTex(r"\frac{\sqrt{1}}{2}"),
MathTex(r"\frac{... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.table.IntegerTable.html",
"original_name": "IntegerTable "
} |
Demonstrate a static math table with various visual elements, including rows and columns of numbers. | from manim import *
class MathTableExample(Scene):
def construct(self):
t0 = MathTable(
[["+", 0, 5, 10],
[0, 0, 5, 10],
[2, 2, 7, 12],
[4, 4, 9, 14]],
include_outer_lines=True)
self.add(t0) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.table.MathTable.html",
"original_name": "MathTable "
} |
Create a rotating table with colored circles that demonstrate transformation and alignment of MobjectTable. | from manim import *
class MobjectTableExample(Scene):
def construct(self):
cross = VGroup(
Line(UP + LEFT, DOWN + RIGHT),
Line(UP + RIGHT, DOWN + LEFT),
)
a = Circle().set_color(RED).scale(0.5)
b = cross.set_color(BLUE).scale(0.5)
t0 = MobjectTable(
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.table.MobjectTable.html",
"original_name": "MobjectTable "
} |
Demonstrate the creation of multiple tables with various visual elements, including row and column labels, highlighted cells, and custom line styles. | from manim import *
class TableExamples(Scene):
def construct(self):
t0 = Table(
[["This", "is a"],
["simple", "Table in \\n Manim."]])
t1 = Table(
[["This", "is a"],
["simple", "Table."]],
row_labels=[Text("R1"), Text("R2")],
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.table.Table.html",
"original_name": "Table "
} |
Demonstrate movement of a dot on the complex plane in response to value updates. | from manim import *
class ComplexValueTrackerExample(Scene):
def construct(self):
tracker = ComplexValueTracker(-2+1j)
dot = Dot().add_updater(
lambda x: x.move_to(tracker.points)
)
self.add(NumberPlane(), dot)
self.play(tracker.animate.set_value(3+2j))
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.value_tracker.ComplexValueTracker.html",
"original_name": "ComplexValueTracker "
} |
Show a dynamic number line with an animated pointer, tracking changes to its position, and updating the label accordingly. | from manim import *
class ValueTrackerExample(Scene):
def construct(self):
number_line = NumberLine()
pointer = Vector(DOWN)
label = MathTex("x").add_updater(lambda m: m.next_to(pointer, UP))
tracker = ValueTracker(0)
pointer.add_updater(
lambda m: m.next_to(
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.value_tracker.ValueTracker.html",
"original_name": "ValueTracker "
} |
Demonstrate a mathematical function as an arrow field, mapping 2D space to a 2D vector. | from manim import *
class BasicUsage(Scene):
def construct(self):
func = lambda pos: ((pos[0] * UR + pos[1] * LEFT) - pos) / 3
self.add(ArrowVectorField(func)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.vector_field.ArrowVectorField.html",
"original_name": "ArrowVectorField "
} |
Demonstrate a flowing stream of lines that smoothly move and curve in a diagonal path. | from manim import *
class BasicUsage(Scene):
def construct(self):
func = lambda pos: ((pos[0] * UR + pos[1] * LEFT) - pos) / 3
self.add(StreamLines(func)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.vector_field.StreamLines.html",
"original_name": "StreamLines "
} |
Demonstrate a 3D vector field with arrows nudging a gray circle and a white dot in sync. | from manim import *
class Nudging(Scene):
def construct(self):
func = lambda pos: np.sin(pos[1] / 2) * RIGHT + np.cos(pos[0] / 2) * UP
vector_field = ArrowVectorField(
func, x_range=[-7, 7, 1], y_range=[-4, 4, 1], length_func=lambda x: x / 2
)
self.add(vector_field)
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.mobject.vector_field.VectorField.html",
"original_name": "VectorField "
} |
Create a camera animation that scales its width while restoring the original frame size. | from manim import *
class ChangingCameraWidthAndRestore(MovingCameraScene):
def construct(self):
text = Text("Hello World").set_color(BLUE)
self.add(text)
self.camera.frame.save_state()
self.play(self.camera.frame.animate.set(width=text.width * 1.2))
self.wait(0.3)
s... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.scene.moving_camera_scene.html",
"original_name": "moving_camera_scene "
} |
Show a "Hello World!" text appearing on the screen. | class MyScene(Scene):
def construct(self):
self.play(Write(Text("Hello World!"))) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.scene.scene.Scene.html",
"original_name": "Scene "
} |
Demonstrate a linear transformation on a 2D grid, rotating and scaling a vector by the given matrix. | from manim import *
class LinearTransformationSceneExample(LinearTransformationScene):
def __init__(self, **kwargs):
LinearTransformationScene.__init__(
self,
show_coordinates=True,
leave_ghost_vectors=True,
**kwargs
)
def construct(self):
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.scene.vector_space_scene.LinearTransformationScene.html",
"original_name": "LinearTransformationScene "
} |
Create a zoomed scene that starts with a green dot, then suddenly moves to the left. | from manim import *
class UseZoomedScene(ZoomedScene):
def construct(self):
dot = Dot().set_color(GREEN)
self.add(dot)
self.wait(1)
self.activate_zooming(animate=False)
self.wait(1)
self.play(dot.animate.shift(LEFT)) | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.scene.zoomed_scene.html",
"original_name": "zoomed_scene "
} |
Demonstrate mathematical formula with color-coded indices and highlighted terms using animated MathTex and index labels. | from manim import *
class IndexLabelsExample(Scene):
def construct(self):
text = MathTex(
"\\frac{d}{dx}f(x)g(x)=",
"f(x)\\frac{d}{dx}g(x)",
"+",
"g(x)\\frac{d}{dx}f(x)",
)
#index the fist term in the MathTex mob
indices = index_label... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.utils.debug.html",
"original_name": "debug "
} |
Demonstrate a clockwise transformation of four colored dots along their circular paths. | from manim import *
class ClockwisePathExample(Scene):
def construct(self):
colors = [RED, GREEN, BLUE]
starting_points = VGroup(
*[
Dot(LEFT + pos, color=color)
for pos, color in zip([UP, DOWN, LEFT], colors)
]
)
finish_poin... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.utils.paths.html",
"original_name": "paths "
} |
Demonstrate the plotting of various rate functions in a grid layout with titles. | from manim import *
class RateFuncExample(Scene):
def construct(self):
x = VGroup()
for k, v in rate_functions.__dict__.items():
if "function" in str(v):
if (
not k.startswith("__")
and not k.startswith("sqrt")
... | null | {
"source": "https://docs.manim.community/en/stable/reference/manim.utils.rate_functions.html",
"original_name": "rate_functions "
} |
Show a colorful logo animation consisting of a triangle, square, circle, and math symbol, arranged in a specific order, with smooth transitions. | class ManimCELogo(Scene):
def construct(self):
self.camera.background_color = "#ece6e2"
logo_green = "#87c2a5"
logo_blue = "#525893"
logo_red = "#e07a5f"
logo_black = "#343434"
ds_m = MathTex(r"\mathbb{M}", fill_color=logo_black).scale(7)
ds_m.shift(2.25 * LEF... | ManimCELogo | null |
Show a diagram with an orange line, two dots, and arrows labeled "Horizontal distance" and "x-x_1". | class BraceAnnotation(Scene):
def construct(self):
dot = Dot([-2, -1, 0])
dot2 = Dot([2, 1, 0])
line = Line(dot.get_center(), dot2.get_center()).set_color(ORANGE)
b1 = Brace(line)
b1text = b1.get_text("Horizontal distance")
b2 = Brace(line, direction=line.copy().rotat... | BraceAnnotation | null |
Create a diagram showing an arrow with coordinates on a number plane. | class VectorArrow(Scene):
def construct(self):
dot = Dot(ORIGIN)
arrow = Arrow(ORIGIN, [2, 2, 0], buff=0)
numberplane = NumberPlane()
origin_text = Text('(0, 0)').next_to(dot, DOWN)
tip_text = Text('(2, 2)').next_to(arrow.get_end(), RIGHT)
self.add(numberplane, dot, a... | VectorArrow | null |
Create a large gradient image by scaling and coloring a 2D array of pixel values. | class GradientImageFromArray(Scene):
def construct(self):
n = 256
imageArray = np.uint8(
[[i * 256 / n for i in range(0, n)] for _ in range(0, n)]
)
image = ImageMobject(imageArray).scale(2)
image.background_rectangle = SurroundingRectangle(image, color=GREEN)
... | GradientImageFromArray | null |
Demonstrate visualizations of basic Boolean operations (intersection, union, exclusion, difference) between two overlapping ellipses. | class BooleanOperations(Scene):
def construct(self):
ellipse1 = Ellipse(
width=4.0, height=5.0, fill_opacity=0.5, color=BLUE, stroke_width=10
).move_to(LEFT)
ellipse2 = ellipse1.copy().set_color(color=RED).move_to(RIGHT)
bool_ops_text = MarkupText("Boolean Operation").nex... | BooleanOperations | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.