Commit 7cea45bd authored by Shiven Bhatt's avatar Shiven Bhatt
Browse files

got slides working

parent 4c6893d2
from time import gmtime
from cv2 import rectangle
from manim import *
from numpy import tri
SCREEN_WIDTH = 14.2
SCREEN_HEIGHT = 8
class Slide:
def __init__(self, objects, durations):
self.objects = objects
self.durations = durations
class Slide1(Scene):
def construct(self):
self.image_slideshow([
(["giraffe.jpg"], 3),
(["giraffe.jpg", "giraffe2.jpg", "giraffe.jpg"], 3),
self.slideshow([
Slide([self.get_image_group(["giraffe.jpg"])], [3]),
Slide([self.get_image_group(["giraffe.jpg", "giraffe.jpg", "giraffe2.jpg"])], [3]),
])
def image_slideshow(self, slides):
def 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))
for i in range(0, len(slide.objects)):
self.play(FadeIn(slide.objects[i]))
self.wait(slide.durations[i])
self.play(FadeOut(*slide.objects))
def get_image_group(self, images):
image_width = SCREEN_WIDTH / (len(images))
......@@ -57,7 +59,6 @@ class HappySphere(Scene):
self.wait(3)
self.play(FadeOut(im, text))
class RasterizationTriangleScene(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi=PI / 4, theta=PI / 6, gamma= PI / 2)
......@@ -69,6 +70,8 @@ class RasterizationTriangleScene(ThreeDScene):
self.add(cube)
self.wait(1)
Line3D(start=[], end=[])
triangle = Polygon([0, 0, 0], [0, 1, 0], [1, 0, 0], stroke_width = 1, stroke_color=RED)
triangle.shift([-0.5, -0.5, 2.5])
self.play(Create(triangle))
......@@ -77,4 +80,7 @@ class RasterizationTriangleScene(ThreeDScene):
self.play(Transform(triangle, plane_triangle))
self.wait(1)
self.move_camera(phi=PI, theta=0, gamma= PI / 2)
self.wait(1)
\ No newline at end of file
self.wait(1)
class RaytracingScene(Scene):
pass
\ No newline at end of file
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