from manimvtk import *class ColoredShapes(Scene): def construct(self): # Create a grid of colored circles colors = [RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE] circles = VGroup(*[ Circle(radius=0.5, color=color, fill_opacity=0.7) for color in colors ]) circles.arrange_in_grid(rows=2, cols=3, buff=0.5) # Animate creation with lag self.play(LaggedStart(*[Create(c) for c in circles], lag_ratio=0.2)) self.wait()
from manimvtk import *class FadeExample(Scene): def construct(self): shapes = VGroup(*[ Square(side_length=1).shift(direction * 2) for direction in [LEFT, ORIGIN, RIGHT] ]) # Fade in self.play(FadeIn(shapes)) self.wait() # Fade out one by one for shape in shapes: self.play(FadeOut(shape)) self.wait()
from manimvtk import *class GrowExample(Scene): def construct(self): shapes = VGroup( Circle(color=BLUE), Square(color=RED).shift(RIGHT * 2.5), Triangle(color=GREEN).shift(LEFT * 2.5) ) # Grow from center self.play(*[GrowFromCenter(shape) for shape in shapes]) self.wait() # Shrink to center self.play(*[ShrinkToCenter(shape) for shape in shapes])
from manimvtk import *class GridArrangement(Scene): def construct(self): # Create 12 squares squares = VGroup(*[Square(side_length=0.5) for _ in range(12)]) # Arrange in 3x4 grid squares.arrange_in_grid(rows=3, cols=4, buff=0.3) # Color by row for i, row in enumerate([squares[0:4], squares[4:8], squares[8:12]]): row.set_color([RED, GREEN, BLUE][i]) self.play(Create(squares)) self.wait()
from manimvtk import *class CircularArrangement(Scene): def construct(self): dots = VGroup(*[Dot() for _ in range(8)]) dots.arrange_in_circle(radius=2) self.play(LaggedStart(*[GrowFromCenter(dot) for dot in dots], lag_ratio=0.1)) self.wait()