mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
|
|
from manim import *
|
|
|
|
# To watch one of these scenes, run the following:
|
|
# python --quality m manim example_scenes.py SquareToCircle -p
|
|
#
|
|
# Use the flag --quality l for a faster rendering at a lower quality.
|
|
# Use -s to skip to the end and just save the final frame
|
|
# Use the -p to have preview of the animation (or image, if -s was
|
|
# used) pop up once done.
|
|
# Use -n <number> to skip ahead to the n'th animation of a scene.
|
|
# Use -r <number> to specify a resolution (for example, -r 1080
|
|
# for a 1920x1080 video)
|
|
|
|
from manim import *
|
|
|
|
|
|
class Dot1(Scene):
|
|
def construct(self):
|
|
dot = Dot().set_color(GREEN)
|
|
self.add(dot)
|
|
self.wait(1)
|
|
|
|
|
|
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(ShowCreation(square))
|
|
self.play(Transform(square, circle))
|
|
self.play(FadeOut(square))
|
|
|
|
|
|
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()
|