def run(self): hue_step = 1 / float(self.wall.width * self.wall.height) cache_list = [] cache_cnt = random.randint(5, 15) offset_step = 1.0 / cache_cnt ttl = max(1.5, random.random() * 3) / cache_cnt offset = random.random() # prepare for cache_idx in range(cache_cnt): cache = [] for cnt, pixel in enumerate(self.draw_list): x = pixel[0] y = pixel[1] hue = ((hue_step * cnt) + offset) % 1.0 cache.append((x, y, hue)) self.wall.pixel(x, y).hsv = (hue, 1, 1) cache_list.append(cache) offset += offset_step # draw wall = self.wall for cache in cache_list: wall2 = wall.copy() for pixel in cache: wall2.pixel(pixel[0], pixel[1]).hsv = (pixel[2], 1, 1) fi = FadeIter(wall, wall2, ttl) fi.run() wall = wall2 wall2 = wall.copy(True) fi = FadeIter(wall, wall2, ttl) fi.run()
def run(self): h=random.random() hb=1-h b=self.Ball((random.random(),1,1),(random.randint(1,5),random.randint(1,5)),1,1) b2=self.Ball((h,1,1),(random.randint(1,5),random.randint(1,5)),-1,1) for i in range (1,150): wall=self.wall wall2=self.wall.copy() self.drawbackground((hb,1,0.1),wall) b.draw(wall) b2.draw(wall) self.moveball(b) self.moveball(b2) fi = FadeIter(wall2, wall, 0.07) fi.run()
def run(self): h = random.random() hb = 1 - h b = self.Ball((random.random(), 1, 1), (random.randint(1, 5), random.randint(1, 5)), 1, 1) b2 = self.Ball((h, 1, 1), (random.randint(1, 5), random.randint(1, 5)), -1, 1) for i in range(1, 150): wall = self.wall wall2 = self.wall.copy() self.drawbackground((hb, 1, 0.1), wall) b.draw(wall) b2.draw(wall) self.moveball(b) self.moveball(b2) fi = FadeIter(wall2, wall, 0.07) fi.run()
def run(self): hue_step = 1 / float(self.wall.width * self.wall.height) offset = random.random() cnt = 0 cache = [] for pixel in self.draw_list: x = pixel[0] y = pixel[1] hue = ((hue_step * cnt) + offset) % 1.0 cache.append((x, y, hue)) self.wall.pixel(x, y).hsv = (hue, 1, 1) self.wall.draw() time.sleep(.02) cnt += 1 wall = self.wall for pixel in cache: wall2 = wall.copy() wall2.pixel(pixel[0], pixel[1]).rgb = (0, 0, 0) fi = FadeIter(wall, wall2, .001) wall = wall2 fi.run()
def run(self): hue_step = 1 / float(self.wall.width * self.wall.height) cache_list = [] cache_cnt = random.randint(5,15) offset_step = 1.0 / cache_cnt ttl = max(1.5, random.random() * 3) / cache_cnt offset = random.random() # prepare for cache_idx in range(cache_cnt): cache = [] for cnt, pixel in enumerate(self.draw_list): x = pixel[0] y = pixel[1] hue = ((hue_step * cnt) + offset) % 1.0 cache.append((x, y, hue)) self.wall.pixel(x, y).hsv = (hue, 1, 1) cache_list.append(cache) offset += offset_step # draw wall = self.wall for cache in cache_list: wall2 = wall.copy() for pixel in cache: wall2.pixel(pixel[0], pixel[1]).hsv = (pixel[2], 1, 1) fi = FadeIter(wall, wall2, ttl) fi.run() wall = wall2 wall2 = wall.copy(True) fi = FadeIter(wall, wall2, ttl) fi.run()