Skip to content

Instantly share code, notes, and snippets.

@crabdancing
Last active August 27, 2022 21:03
Show Gist options
  • Save crabdancing/98ea885adc287c23ae2cd390fe5cb7e0 to your computer and use it in GitHub Desktop.
Save crabdancing/98ea885adc287c23ae2cd390fe5cb7e0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from typing import List
from manim import *
import os
from manim.utils.file_ops import open_file as open_media_file
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))
class TriangleToCircle(Scene):
def construct(self):
circle = Circle()
square = Triangle()
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))
show_scenes = [SquareToCircle, TriangleToCircle]
if __name__ == '__main__':
for scene_class in show_scenes:
scene = scene_class()
scene.render()
open_media_file(scene.renderer.file_writer.movie_file_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment