def update_at_progress(self, progress, new_loop, loop_instance): units = geom.by_faces for ix, unit in enumerate(units): distance = 0 l = len(unit) - 1 for jx, cell_id in enumerate(unit): if self.cm.modifiers[1]: # Reverse distance = (float(l-jx) / float(len(unit))) + progress else: distance = (float(jx) / float(len(unit))) + progress # Clamp if distance > 1.0: distance = distance - 1.0 if distance < 0.0: distance = distance + 1.0 # Color if self.cm.modifiers[0]: clr = color.HSVryb(distance, 1.0, 1.0) elif self.cm.modifiers[1]: clr = color.Color(tween.hsvLinear(self.cm.chosen_colors[0], self.cm.chosen_colors[1], distance)) else: clr = color.HSV(distance, 1.0, 1.0) # Set the one cell self.ss.party.set_cell(cell_id, clr)
def render_cells(self, level, hue): #clr = color.HSVryb(hue, 1.0, 1.0 - level) h = hue + self.hue_offset if h > 1.0: h -= 1.0 if level < 0.1: clr = color.BLACK else: clr = color.HSVryb(h, level, 1.0) # clr = self.bg.interpolate_to(self.fg, level) self.cells.set_cells(self.target, clr)
def render_spike(self, spike, level, hue): h = hue + self.hue_offset if h > 1.0: h -= 1.0 clr = color.HSVryb(h, level, 1.0) start = int(round(len(spike) * (1.0 - level))) for idx, c in enumerate(spike): if idx < start: self.cells.set_cell(c, color.BLACK) else: self.cells.set_cell(c, clr)
def update_at_progress(self, progress, new_loop, loop_instance): mode = self.step_mode(self.num_steps) # mode 0 stripes = geom.by_long_planes if mode == 1: stripes = geom.by_short_planes elif mode == 2: stripes = geom.by_edges elif mode == 3: stripes = geom.by_faces # elif mode == 4: # stripes = geom.SPIRAL # elif mode == 5: # stripes = geom.ICICLES l = len(stripes) - 1 for ix, row in enumerate(stripes): distance = 0.0 if self.cm.modifiers[1]: # Reverse distance = (float(l - ix) / float(len(stripes))) + progress else: # Normal progression distance = (float(ix) / float(len(stripes))) + progress # Clamp while distance > 1.0: distance = distance - 1.0 while distance < 0.0: distance = distance + 1.0 if self.cm.modifiers[0]: clr = color.HSVryb(distance, 1.0, 1.0) elif self.cm.modifiers[1]: clr = color.Color( tween.hsvLinear(self.cm.chosen_colors[0], self.cm.chosen_colors[1], distance)) else: clr = color.HSV(distance, 1.0, 1.0) if mode == 4: self.ss.both.set_cell(row, clr) else: self.ss.both.set_cells(row, clr)
def update_at_progress(self, progress, new_loop, loop_instance): mode = self.step_mode(2) # mode 0 stripes = geom.BIRDS if mode == 1: stripes = geom.ATOMS # elif mode == 2: # stripes = geom.RINGS # elif mode == 3: # stripes = geom.QUADRANTS # elif mode == 4: # stripes = geom.SPIRAL # elif mode == 5: # stripes = geom.ICICLES l = len(stripes) - 1 for ix, row in enumerate(stripes): distance = 0.0 if self.cm.modifiers[1]: # Reverse distance = (float(l - ix) / float(len(stripes))) + progress else: # Normal progression distance = (float(ix) / float(len(stripes))) + progress # Clamp while distance > 1.0: distance = distance - 1.0 while distance < 0.0: distance = distance + 1.0 if self.cm.modifiers[0]: clr = color.HSVryb(distance, 1.0, 1.0) else: clr = color.HSV(distance, 1.0, 1.0) if mode == 4: self.ss.party.set_cell(row, clr) else: self.ss.party.set_cells(row, clr)