import time LD.set_scan_rate(30000) LD.set_blanking_delay(0) while True: t = time.localtime() hours = t.tm_hour%12 minutes = t.tm_min seconds = t.tm_sec # LD.set_color(RED) # LD.draw_text("%02i:%02i:%02i"%(hours,minutes,seconds), 220, 220, 20) LD.set_color(GREEN) angle = 2*PI*seconds/60 + PI/2 r = 2.0/3 * (WIDTH/2) LD.draw_line(WIDTH/2, HEIGHT/2, WIDTH/2 + r*math.cos(angle), HEIGHT/2 + r*math.sin(angle)) LD.set_color(BLUE) angle = 2*PI*minutes/60 + 2*PI/60 * float(seconds)/60 + PI/2 LD.draw_line(WIDTH/2, HEIGHT/2, WIDTH/2 + r*math.cos(angle), HEIGHT/2 + r*math.sin(angle)) angle = 2*PI*hours/12 + 2*PI*minutes/(60*12) + PI/2 r *= 2.0/3 LD.draw_line(WIDTH/2, HEIGHT/2, WIDTH/2 + r*math.cos(angle), HEIGHT/2 + r*math.sin(angle)) r1 = 2.0/3 * (WIDTH/2) r2 = 1.9/3 * (WIDTH/2)
WIDTH = 200 HEIGHT = 200 import sys import random ilda_file = open(sys.argv[1], 'rb') ilda_frames = ILDA.readFrames(ilda_file) frames = [] for f in ilda_frames: frame = [] for p in f.iterPoints(): frame.append( [WIDTH / 2 + (WIDTH / 2) * p.x, HEIGHT / 2 + (HEIGHT / 2) * p.y]) frames.append(frame) ilda_file.close() LD.set_color(YELLOW) for frame in frames: for _ in range(2): for point in frame: #LD.set_color(p.color) if random.random() <= 0.5: LD.draw_point(point[0], point[1]) m = LD.messageBuffer while True: LD.messageBuffer = m LD.show_frame()
TOTAL_TIME=float(sys.argv[2]) TIME_STRETCH = 1 ZOOM=1.0 DELTA = 1 DEGRADATION = 0.40 #DEGRADATION is the percentage of points that we ignore in order to render # faster in the laser display. Unfortunately we are not able to render too # complex content in our display without resulting in a lot of blinking. gml = readFile() LD = LaserDisplay({"server":"localhost","port": 50000}) #LD = LaserDisplay() LD.set_scan_rate(35000) LD.set_blanking_delay(0) LD.set_color(RED) t0=datetime.now() num_frame=0 while True: delta = datetime.now() - t0 t = delta.seconds + delta.microseconds/1000000.0 t = float(t)/TIME_STRETCH if t > TOTAL_TIME: t0=datetime.now() num_frame+=1 print num_frame, t for stroke in gml.iterStrokes(): first=True
HEIGHT = 100 #LD = LaserDisplay() LD = LaserDisplay({"server":"localhost","port": 50000}) ship = [[190, 64], [168, 136], [118, 200], [77, 142], [63, 63], [87, 77], [105, 103], [119, 114], [143, 104], [158, 81], [192, 63]] cx,cy = WIDTH/2, HEIGHT/2 angle=0 while True: angle+=0.01 LD.save() LD.scale(0.2) LD.rotate_at(cx,cy,angle) LD.set_color(RED) LD.draw_bezier(ship, 10) LD.translate(10,0) LD.set_color(GREEN) LD.draw_bezier(ship, 10) LD.restore() LD.save() LD.scale(0.4) LD.rotate_at(cx,cy,angle+2*PI*0.4) LD.translate(30,50) LD.set_color(RED) LD.draw_bezier(ship, 10)
for y in range(80): pygame.draw.line(grid, GRIDCOLOR, (SIZE[0]/2 - 3, y*SIZE[1]/80), (SIZE[0]/2 + 3, y*SIZE[1]/80)) surface = pygame.Surface(screen.get_size()) x_old=0 y_old=0 for _ in range(1000): frames = wro.readframes(READ_LENGTH) display = LaserDisplay({"server":"localhost","port": 50000}) #display = LaserDisplay() display.set_scan_rate(45000) display.set_blanking_delay(0) display.set_color(WHITE) while True: try: clock.tick(FPS) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() # for _ in range(30): # frames = wro.readframes(READ_LENGTH) frames = wro.readframes(READ_LENGTH) surface.fill(BGCOLOR) surface.blit(grid, grid.get_rect()) SKIP=1
WIDTH=200 HEIGHT=200 import sys import random ilda_file = open(sys.argv[1], 'rb') ilda_frames = ILDA.readFrames(ilda_file) frames = [] for f in ilda_frames: frame = [] for p in f.iterPoints(): frame.append([WIDTH/2 + (WIDTH/2)*p.x, HEIGHT/2 + (HEIGHT/2)*p.y]) frames.append(frame) ilda_file.close() LD.set_color(YELLOW) for frame in frames: for _ in range(2): for point in frame: #LD.set_color(p.color) if random.random()<=0.5: LD.draw_point(point[0], point[1]) m = LD.messageBuffer while True: LD.messageBuffer = m LD.show_frame()