from manim import *
class CircleExample(Scene):
def construct(self):
circle = Circle(color=BLUE, fill_opacity=0.5)
self.add(circle)
from manim import *
class SquareExample(Scene):
def construct(self):
square = Square(color=YELLOW, fill_opacity=0.5)
self.add(square)
from manim import *
class UnionExample(Scene):
def construct(self):
sq = Square(color=RED, fill_opacity=1).move_to([-2, 0, 0])
cr = Circle(color=BLUE, fill_opacity=1).move_to([-1.3, 0.7, 0])
un = Union(sq, cr, color=GREEN, fill_opacity=1).move_to([1.5, 0.3, 0])
self.add(sq, cr, un)
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()
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
square = Square()
square.flip(RIGHT)
square.rotate(-3 * TAU / 8)
circle.set_fill(PINK, opacity=0.5)
self.play(Create(square))
self.play(Transform(square, circle))
self.play(FadeOut(square))