Commit 3e572ee1 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 e5bd994f 1980d8ca
from manim import *
from matplotlib.lines import Line2D
SCREEN_WIDTH = 14.2
SCREEN_HEIGHT = 8
......@@ -104,4 +105,34 @@ class RasterizationTriangleScene(ThreeDScene):
class RaytracingScene(Scene):
def construct(self):
square = Square(side_length=3)
square.shift([1, 1])
square.shift([1, 1, 0])
circle = Circle(radius=1.5)
circle.shift([-3, -2, 0])
triangle = Triangle()
triangle.shift([1.5, -3, 0])
lightbulb = ImageMobject("lightbulb.png")
lightbulb.shift([-0.75, -3.5, 0])
self.add(lightbulb)
self.play(Create(square), run_time=0.5)
self.play(Create(circle), run_time=0.5)
self.play(Create(triangle), run_time=0.5)
self.wait(1)
light_rays = [
([-2, 5, 0], [-2, -0.85, 0]),
([-2, -0.85, 0], [1.4, -2.2, 0]),
([1.4, -2.2, 0], [0, -0.5, 0]),
([0, -0.5, 0], [-0.7, -3.3, 0])
]
for ray in light_rays:
self.play(Create(Line3D(start=ray[0], end=ray[1], color=YELLOW)), run_time=0.5)
self.wait(3)
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