Commit 9e6ed5d1 authored by Ethan Fisher's avatar Ethan Fisher
Browse files

spheres-anim

parent 55c05557
from manim import *
SCREEN_WIDTH = 14.2
SCREEN_HEIGHT = 8
class Slide1(Scene):
def construct(self):
image_no_raytracing = ImageMobject("giraffe.jpg")
......@@ -12,5 +15,57 @@ class Slide1(Scene):
image_with_raytracing.set_y(0)
image_with_raytracing.scale_to_fit_width(1)
self.play(FadeIn(image_no_raytracing, image_with_raytracing), run_time=3)
self.play(FadeIn(image_no_raytracing, image_with_raytracing), run_time=1)
self.wait(5)
class Video(Scene):
def construct(self):
self.image_slideshow([
(["giraffe.jpg"], 3),
(["giraffe.jpg", "giraffe2.jpg", "giraffe.jpg"], 3)
])
def image_slideshow(self, slides):
for slide in slides:
images, duration = slide
group = self.get_image_group(images)
self.play(FadeIn(group))
self.wait(duration)
self.play(FadeOut(group))
def get_image_group(self, images):
image_width = SCREEN_WIDTH / (len(images))
all_images = []
for image in images:
im = ImageMobject(image)
im.scale_to_fit_width(image_width)
all_images.append(im)
group = Group(*all_images)
group.arrange()
return group
class SadSphere(Scene):
def construct(self):
im = ImageMobject("sad_sphere.png")
im.scale_to_fit_height(SCREEN_HEIGHT)
spacer = Text("d",font_size=90).scale(0.5).align_to(im,DOWN)
text = Text("\"I'm not smooth\" :(",color="white",font_size=90).scale(0.5).next_to(spacer,UP)
self.play(FadeIn(im))
self.wait(3)
self.play(FadeIn(text))
self.wait(3)
self.play(FadeOut(im, text))
class HappySphere(Scene):
def construct(self):
im = ImageMobject("happy_sphere.png")
im.scale_to_fit_height(SCREEN_HEIGHT)
spacer = Text("d",font_size=90).scale(0.5).align_to(im,DOWN)
text = Text("\"I'm smooth!\" :)",color="white",font_size=90).scale(0.5).next_to(spacer,UP)
self.play(FadeIn(im))
self.wait(3)
self.play(FadeIn(text))
self.wait(3)
self.play(FadeOut(im, text))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment