Skip to content
Snippets Groups Projects
Commit 7cea45bd authored by Shiven Bhatt's avatar Shiven Bhatt
Browse files

got slides working

parent 4c6893d2
No related branches found
No related tags found
No related merge requests found
from time import gmtime
from cv2 import rectangle
from manim import * from manim import *
from numpy import tri
SCREEN_WIDTH = 14.2 SCREEN_WIDTH = 14.2
SCREEN_HEIGHT = 8 SCREEN_HEIGHT = 8
class Slide:
def __init__(self, objects, durations):
self.objects = objects
self.durations = durations
class Slide1(Scene): class Slide1(Scene):
def construct(self): def construct(self):
self.image_slideshow([ self.slideshow([
(["giraffe.jpg"], 3), Slide([self.get_image_group(["giraffe.jpg"])], [3]),
(["giraffe.jpg", "giraffe2.jpg", "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: for slide in slides:
images, duration = slide for i in range(0, len(slide.objects)):
group = self.get_image_group(images) self.play(FadeIn(slide.objects[i]))
self.play(FadeIn(group)) self.wait(slide.durations[i])
self.wait(duration)
self.play(FadeOut(group)) self.play(FadeOut(*slide.objects))
def get_image_group(self, images): def get_image_group(self, images):
image_width = SCREEN_WIDTH / (len(images)) image_width = SCREEN_WIDTH / (len(images))
...@@ -57,7 +59,6 @@ class HappySphere(Scene): ...@@ -57,7 +59,6 @@ class HappySphere(Scene):
self.wait(3) self.wait(3)
self.play(FadeOut(im, text)) self.play(FadeOut(im, text))
class RasterizationTriangleScene(ThreeDScene): class RasterizationTriangleScene(ThreeDScene):
def construct(self): def construct(self):
self.set_camera_orientation(phi=PI / 4, theta=PI / 6, gamma= PI / 2) self.set_camera_orientation(phi=PI / 4, theta=PI / 6, gamma= PI / 2)
...@@ -69,6 +70,8 @@ class RasterizationTriangleScene(ThreeDScene): ...@@ -69,6 +70,8 @@ class RasterizationTriangleScene(ThreeDScene):
self.add(cube) self.add(cube)
self.wait(1) self.wait(1)
Line3D(start=[], end=[])
triangle = Polygon([0, 0, 0], [0, 1, 0], [1, 0, 0], stroke_width = 1, stroke_color=RED) 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]) triangle.shift([-0.5, -0.5, 2.5])
self.play(Create(triangle)) self.play(Create(triangle))
...@@ -77,4 +80,7 @@ class RasterizationTriangleScene(ThreeDScene): ...@@ -77,4 +80,7 @@ class RasterizationTriangleScene(ThreeDScene):
self.play(Transform(triangle, plane_triangle)) self.play(Transform(triangle, plane_triangle))
self.wait(1) self.wait(1)
self.move_camera(phi=PI, theta=0, gamma= PI / 2) self.move_camera(phi=PI, theta=0, gamma= PI / 2)
self.wait(1) self.wait(1)
\ No newline at end of file
class RaytracingScene(Scene):
pass
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment