from manim import *
class WorkShop(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
self.add(axes)
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
self.begin_ambient_camera_rotation(rate=0.4)
self.wait(4)
#Construct X Label
dx = Dot()
dx.move_to(axes.c2p(5,0,0))
#Construct X_Label
dx_t = Text('X', font_size=25, color= WHITE).next_to(dx, UR)
dx_t.rotate(PI/2, axis = RIGHT)
self.play(Write(dx_t))
#Construct Y Label
dy = Dot()
dy.move_to(axes.c2p(0,4,0))
#Construct Y_Label
dy_t = Text('Y', font_size=25, color= WHITE).next_to(dy, LEFT)
dy_t.rotate(PI/2, axis = RIGHT)
self.play(Write(dy_t))
#Construct Z Label
dy = Dot()
dy.move_to(axes.c2p(0,0,3))
#Construct Z_Label
dy_t = Text('Z', font_size=25, color= WHITE).next_to(dy, RIGHT)
dy_t.rotate(PI/2, axis = RIGHT)
self.play(Write(dy_t))
#Construct Origin Point
dO = Dot(color=YELLOW)
dO.move_to(axes.c2p(0,0,0))
#Construct Origin Text
dO_t = Text('O', font_size=20, color=YELLOW).next_to(dO, RIGHT)
dO_t.rotate(PI / 2, axis=RIGHT)
self.play(Create(dO))
self.play(Write(dO_t))
def polygon():
rec =[(0,0,-3/2),(0,6/2,-3/2),(4/2,6/2,-3/2), (4/2,0,-3/2)]
poly = Polygon(*rec)
poly.set_fill(BLUE_D,opacity = 0.5)
self.play(Create(poly), run_time=2)
return self
polygon()
def polygon2():
rec =[(0,0,0),(4/2,0,0),(4/2,-5/2,0), (0,-5/2,0)]
poly = Polygon(*rec)
poly.set_fill(BLUE_D,opacity = 0.5)
self.play(Create(poly), run_time=2)
return self
polygon2()
# To stop camera rotation:
#self.stop_ambient_camera_rotation()
self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)
self.wait(3)