def draw(self): self.x_phase = 0.4*cos(1.7 * lux.time * self.RATE) + 0.6*cos(0.7 * lux.time * self.RATE) self.y_phase = cos(2.2 * lux.time * self.RATE) self.z_phase = cos(5.7 * lux.time * self.RATE) self.z_ratio = 2 + cos(0.1 * lux.time * self.RATE) ol.loadIdentity3() ol.loadIdentity() ol.perspective(20, 1, 1, 100) ol.translate3((0, 0, -10)) #ol.scale3((0.5, 0.5, 0.5)) ol.rotate3Z(lux.time * pi * 0.01) ol.rotate3X(lux.time * pi * 0.025) ol.rotate3Y(lux.time * pi * 0.013) ol.color3(*(self.color_cycle())) ol.begin(ol.POINTS) decay_factor = 1 first_point = None for i in range(self.SAMPLES_PER_FRAME): theta = float(i) / self.SAMPLES_PER_FRAME * self.MAX_THETA x = sin(self.x_ratio * theta + self.x_phase) y = sin(self.y_ratio * theta + self.y_phase) z = sin(self.z_ratio * theta + self.z_phase) if (i == 0): first_point = (x * decay_factor, y * decay_factor, z * decay_factor) ol.vertex3((x * decay_factor, y * decay_factor, z * decay_factor)) decay_factor = decay_factor * self.decay ol.vertex3(first_point) ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() ol.loadIdentity3() ol.perspective(20, 1, 1, 100) ol.translate3((0, 0, -20)) ol.color3(1.0,1.0,0.0); ol.translate3( (cos(lux.time/2.0), cos(lux.time/3.0), cos(lux.time/7.0)) ) ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.25 * lux.simple_rate) ol.rotate3Y(lux.time * pi * 0.13 * lux.simple_rate) for row in self.torender: ol.begin(ol.LINESTRIP) vi = self.faces[row] vi = vi + [vi[0]] for i in vi: tup = tuple(self.verts[i,:]) ol.vertex3(tup) ol.end()
def draw(self): self.x_phase = 0.4*cos(1.7 * lux.time * self.RATE) + 0.6*cos(0.7 * lux.time * self.RATE) self.y_phase = cos(2.2 * lux.time * self.RATE) self.z_phase = cos(5.7 * lux.time * self.RATE) self.z_ratio = 2 + cos(0.1 * lux.time * self.RATE) ol.loadIdentity3() ol.loadIdentity() ol.perspective(20, 1, 1, 100) ol.translate3((0, 0, -10)) ol.scale3((0.5, 0.5, 0.5)) ol.rotate3Z(lux.time * pi * 0.01) ol.rotate3X(lux.time * pi * 0.025) ol.rotate3Y(lux.time * pi * 0.013) ol.color3(*(self.color_cycle())) ol.begin(ol.POINTS) decay_factor = 1 first_point = None for i in range(self.SAMPLES_PER_FRAME): theta = float(i) / self.SAMPLES_PER_FRAME * self.MAX_THETA x = sin(self.x_ratio * theta + self.x_phase) y = sin(self.y_ratio * theta + self.y_phase) z = sin(self.z_ratio * theta + self.z_phase) if (i == 0): first_point = (x * decay_factor, y * decay_factor, z * decay_factor) ol.vertex3((x * decay_factor, y * decay_factor, z * decay_factor)) decay_factor = decay_factor * self.decay ol.vertex3(first_point) ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() ol.loadIdentity3() ol.perspective(20, 1, 1, 100) ol.translate3((0, 0, -20)) ol.color3(1.0, 1.0, 0.0) ol.translate3( (cos(lux.time / 2.0), cos(lux.time / 3.0), cos(lux.time / 7.0))) ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.25 * lux.simple_rate) ol.rotate3Y(lux.time * pi * 0.13 * lux.simple_rate) for row in self.torender: ol.begin(ol.LINESTRIP) vi = self.faces[row] vi = vi + [vi[0]] for i in vi: tup = tuple(self.verts[i, :]) ol.vertex3(tup) ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() for i in range(2): ol.loadIdentity3() ol.perspective(20, 1, 1, 100) ol.translate3((0, 0, -20)) if (i == 1): ol.color3(1.0, 1.0, 0.0) ol.translate3((cos(lux.time / 2.0), cos(lux.time / 3.0), cos(lux.time / 7.0))) ol.rotate3Z(lux.time * pi * 0.1 * lux.TwoCubes_simple_rate) ol.rotate3X(lux.time * pi * 0.25 * lux.TwoCubes_simple_rate) ol.rotate3Y(lux.time * pi * 0.13 * lux.TwoCubes_simple_rate) else: ol.color3(0.0, 1.0, 1.0) ol.scale3((0.6, 0.6, 0.6)) ol.translate3((cos(lux.time / 3.2), cos(lux.time / 2.6), cos(lux.time / 5.4))) ol.rotate3Z(lux.time * pi * 0.14 * lux.TwoCubes_simple_rate) ol.rotate3X(lux.time * pi * 0.53 * lux.TwoCubes_simple_rate) ol.rotate3Y(lux.time * pi * 0.22 * lux.TwoCubes_simple_rate) ol.begin(ol.LINESTRIP) ol.vertex3((-1, -1, -1)) ol.vertex3((1, -1, -1)) ol.vertex3((1, 1, -1)) ol.vertex3((-1, 1, -1)) ol.vertex3((-1, -1, -1)) ol.vertex3((-1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3((1, 1, 1)) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, -1, 1)) ol.vertex3((1, -1, 1)) ol.vertex3((1, 1, 1)) ol.vertex3((1, 1, -1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3((1, -1, -1)) ol.vertex3((1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, 1, -1)) ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() ol.color3(1.0, 0.0, 1.0); font = ol.getDefaultFont() s = "Lux!" w = ol.getStringWidth(font, 0.2, s) ol.drawString(font, (-w/2,0.1), 0.2, s) ol.perspective(60, 1, 1, 100) ol.translate3((0, 0, -3)) for i in range(2): if (i == 1): ol.color3(1.0,1.0,0.0); else: ol.color3(0.0,1.0,1.0); ol.scale3((0.6, 0.6, 0.6)) ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.8 * lux.simple_rate) ol.rotate3Y(lux.time * pi * 0.73 * lux.simple_rate) ol.begin(ol.LINESTRIP) ol.vertex3((-1, -1, -1)) ol.vertex3(( 1, -1, -1)) ol.vertex3(( 1, 1, -1)) ol.vertex3((-1, 1, -1)) ol.vertex3((-1, -1, -1)) ol.vertex3((-1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP); ol.vertex3(( 1, 1, 1)) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, -1, 1)) ol.vertex3(( 1, -1, 1)) ol.vertex3(( 1, 1, 1)) ol.vertex3(( 1, 1, -1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3(( 1, -1, -1)) ol.vertex3(( 1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, 1, -1)) ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() for i in range(2): ol.loadIdentity3() ol.perspective(20, 1, 1, 100) ol.translate3((0, 0, -20)) if (i == 1): ol.color3(1.0,1.0,0.0); ol.translate3((cos(lux.time/2.0), cos(lux.time/3.0), cos(lux.time/7.0))) ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.25 * lux.simple_rate) ol.rotate3Y(lux.time * pi * 0.13 * lux.simple_rate) else: ol.color3(0.0,1.0,1.0); ol.scale3((0.6, 0.6, 0.6)) ol.translate3((cos(lux.time/3.2), cos(lux.time/2.6), cos(lux.time/5.4))) ol.rotate3Z(lux.time * pi * 0.14 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.53 * lux.simple_rate) ol.rotate3Y(lux.time * pi * 0.22 * lux.simple_rate) ol.begin(ol.LINESTRIP) ol.vertex3((-1, -1, -1)) ol.vertex3(( 1, -1, -1)) ol.vertex3(( 1, 1, -1)) ol.vertex3((-1, 1, -1)) ol.vertex3((-1, -1, -1)) ol.vertex3((-1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP); ol.vertex3(( 1, 1, 1)) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, -1, 1)) ol.vertex3(( 1, -1, 1)) ol.vertex3(( 1, 1, 1)) ol.vertex3(( 1, 1, -1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3(( 1, -1, -1)) ol.vertex3(( 1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, 1, -1)) ol.end()
def draw(self): time = lux.time ctf = self.color_time_frequency clf = self.color_length_frequency caf = self.color_angle_frequency/2 theta0 = abs(math.sin(time*self.time_scale)) for braid_count in range(1,self.NUM_CIRCLES): first = True n = 0 theta = theta0 ol.color3(1.0, 0.0, 1.0); ol.loadIdentity3() ol.loadIdentity() ol.perspective(40, 1, 1, 100) ol.translate3((0, 0, -3)) ol.rotate3Z(lux.time * pi * self.z_rotations[braid_count]) ol.rotate3X(lux.time * pi * self.x_rotations[braid_count]) ol.rotate3Z(lux.time * pi * self.x_rotations[braid_count]) ol.begin(ol.LINESTRIP) while theta < theta0 + 2*pi: r = (0.5+sin(10*theta)/2.0) / float(braid_count) * self.scale x = r * cos(theta) y = r * sin(theta) angle = math.atan2(y, x)/(2*pi) red = abs(math.sin(2*pi*(self.r_prime/3+ctf*time+clf*n+caf*angle)+self.color_phases[braid_count])) green = abs(math.sin(2*pi*(self.g_prime/3+ctf*time+clf*n+caf*angle)+self.color_phases[braid_count])) blue = abs(math.sin(2*pi*(self.b_prime/3+ctf*time+clf*n+caf*angle)+self.color_phases[braid_count])) ol.color3(red, green, blue) ol.vertex3((x,y,0)) n += 1 theta += 1.0/float(self.max_segments) r = (0.5+sin(10*theta)/2.0) / float(braid_count) * self.scale x = r * cos(theta) y = r * sin(theta) ol.vertex3((x,y,0)) # Close the path ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() #ol.color3(1.0, 0.0, 1.0); #font = ol.getDefaultFont() #s = "Lux!" #w = ol.getStringWidth(font, 0.2, s) #ol.drawString(font, (-w/2,0.1), 0.2, s) ol.perspective(60, 1, 1, 100) ol.translate3((0, 0, -3)) #Dodecahedron--------------------------- ol.color3(1.0,1.0,1.0); ol.scale3((0.8, 0.8, 0.8)) ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.8 * lux.simple_rate) ol.rotate3Y(lux.time * pi * 0.73 * lux.simple_rate) for face in self.dodeca_face_edges: ol.begin(ol.LINESTRIP) ol.vertex3(face[0]) ol.vertex3(face[1]) ol.vertex3(face[2]) ol.vertex3(face[3]) ol.vertex3(face[4]) ol.vertex3(face[0]) ol.end() #Icosahedron--------------------------- ol.color3(1.0,1.0,0.0); ol.scale3((0.9, 0.9, 0.9)) ol.rotate3Z(lux.time * pi * 0.5 * lux.simple_rate) #ol.rotate3X(lux.time * pi * 0.8 * lux.simple_rate) #ol.rotate3Y(lux.time * pi * 0.73 * lux.simple_rate) for face in self.icos_face_edges: ol.begin(ol.LINESTRIP) ol.vertex3(face[0]) ol.vertex3(face[1]) ol.vertex3(face[2]) ol.vertex3(face[0]) ol.end() #for strip in self.icos_face_edges: # ol.begin(ol.LINESTRIP) # for f in strip: # ol.vertex3(f) # ol.end() #Cube--------------------------- # ol.color3(0.0,0.0,1.0); # ol.scale3((0.4, 0.4, 0.4)) # #ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) # #ol.rotate3X(lux.time * pi * 0.8 * lux.simple_rate) # ol.rotate3Y(lux.time * pi * 0.73 * lux.simple_rate) # ol.begin(ol.LINESTRIP) # ol.vertex3((-1, -1, -1)) # ol.vertex3(( 1, -1, -1)) # ol.vertex3(( 1, 1, -1)) # ol.vertex3((-1, 1, -1)) # ol.vertex3((-1, -1, -1)) # ol.vertex3((-1, -1, 1)) # ol.end() # ol.begin(ol.LINESTRIP); # ol.vertex3(( 1, 1, 1)) # ol.vertex3((-1, 1, 1)) # ol.vertex3((-1, -1, 1)) # ol.vertex3(( 1, -1, 1)) # ol.vertex3(( 1, 1, 1)) # ol.vertex3(( 1, 1, -1)) # ol.end() # ol.begin(ol.LINESTRIP) # ol.vertex3(( 1, -1, -1)) # ol.vertex3(( 1, -1, 1)) # ol.end() # ol.begin(ol.LINESTRIP) # ol.vertex3((-1, 1, 1)) # ol.vertex3((-1, 1, -1)) # ol.end() #Octahedron------------------------ ol.color3(0.0,0.0,1.0); ol.scale3((.8, .8, .8)) #ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate) ol.rotate3X(lux.time * pi * 0.8 * lux.simple_rate) #ol.rotate3Y(lux.time * pi * 0.73 * lux.simple_rate) for strip in self.octahedron_face_edges: ol.begin(ol.LINESTRIP) for f in strip: ol.vertex3(f) ol.end()
s = "Hi!" w = ol.getStringWidth(font, 0.2, s) ol.drawString(font, (-w/2,0.1), 0.2, ol.C_WHITE, s) ol.perspective(60, 1, 1, 100) ol.translate3((0, 0, -3)) for i in range(2): if (i == 1): ol.color3(1.0,0.0,0.0); else: ol.color3(0.0,1.0,0.0); ol.scale3((0.6, 0.6, 0.6)) ol.rotate3Z(time * pi * 0.1) ol.rotate3X(time * pi * 0.8) ol.rotate3Y(time * pi * 0.73) ol.begin(ol.LINESTRIP) ol.vertex3((-1, -1, -1)) ol.vertex3(( 1, -1, -1)) ol.vertex3(( 1, 1, -1)) ol.vertex3((-1, 1, -1)) ol.vertex3((-1, -1, -1)) ol.vertex3((-1, -1, 1)) ol.end() ol.begin(ol.LINESTRIP); ol.vertex3(( 1, 1, 1)) ol.vertex3((-1, 1, 1)) ol.vertex3((-1, -1, 1))
while True: ol.loadIdentity3() ol.loadIdentity() font = ol.getDefaultFont() s = "Hi!" w = ol.getStringWidth(font, 0.2, s) ol.drawString(font, (-w / 2, 0.1), 0.2, ol.C_WHITE, s) ol.perspective(60, 1, 1, 100) ol.translate3((0, 0, -3)) for i in range(2): ol.scale3((0.6, 0.6, 0.6)) ol.rotate3Z(time * pi * 0.1) ol.rotate3X(time * pi * 0.8) ol.rotate3Y(time * pi * 0.73) ol.begin(ol.LINESTRIP) ol.vertex3((-1, -1, -1), ol.C_WHITE) ol.vertex3((1, -1, -1), ol.C_WHITE) ol.vertex3((1, 1, -1), ol.C_WHITE) ol.vertex3((-1, 1, -1), ol.C_WHITE) ol.vertex3((-1, -1, -1), ol.C_WHITE) ol.vertex3((-1, -1, 1), ol.C_WHITE) ol.end() ol.begin(ol.LINESTRIP) ol.vertex3((1, 1, 1), ol.C_WHITE) ol.vertex3((-1, 1, 1), ol.C_WHITE) ol.vertex3((-1, -1, 1), ol.C_WHITE)