Commit 6e93f0af authored by Ethan Fisher's avatar Ethan Fisher
Browse files

Merge branch 'main' of gitlab.cs.washington.edu:shivbat/project_toon_cse457 into main

parents 86940d82 4c6893d2
from time import gmtime
from cv2 import rectangle
from manim import *
from numpy import tri
SCREEN_WIDTH = 14.2
SCREEN_HEIGHT = 8
class Slide1(Scene):
def construct(self):
image_no_raytracing = ImageMobject("giraffe.jpg")
image_with_raytracing = ImageMobject("giraffe2.jpg")
image_no_raytracing.set_x(-1)
image_no_raytracing.set_y(0)
image_no_raytracing.scale_to_fit_width(1)
image_with_raytracing.set_x(1)
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=1)
self.wait(5)
class Video(Scene):
def construct(self):
self.image_slideshow([
(["giraffe.jpg"], 3),
(["giraffe.jpg", "giraffe2.jpg", "giraffe.jpg"], 3)
(["giraffe.jpg", "giraffe2.jpg", "giraffe.jpg"], 3),
])
def image_slideshow(self, slides):
......@@ -82,3 +70,24 @@ def Title(Scene):
self.wait(3)
self.play(FadeOut(t0,t1,t2,t3))
class RasterizationTriangleScene(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi=PI / 4, theta=PI / 6, gamma= PI / 2)
cube = Cube(side_length=1)
cube.shift([0, 0, 3])
rect = Rectangle(width=7, height=5)
rect.shift([-1, 0, -4])
self.add(rect)
self.add(cube)
self.wait(1)
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))
plane_triangle = Polygon([0, 0, 0], [0, 0.7, 0], [0.7, 0, 0], stroke_width = 1, stroke_color=RED)
plane_triangle.shift([-0.35, -0.35, -4])
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
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