def darken(self, pixels, down): if down > 0: # some columns get darker than others col_fade = (utils.randrange(.95, 1.0, self.layout.columns)**down) # get darker as we move down. .95**40 = .12; .97**40=.3 self.shade_factor = np.concatenate(( self.shade_factor[down:, :] * col_fade, utils.randrange(.4, 1.0, (down, self.layout.columns)))) pixels[:40,:] = pixels[:40, :] * np.dstack([self.shade_factor] * 3)
def transition_period(self, now): return utils.randrange(4, 9) diff = max(np.abs(self.end_pt - self.start_pt)) return max(2, diff / 2)
def default_period(now): return utils.randrange(1, 4)
def _init_shade_factor(self): fade_out = np.stack([ utils.randrange(.95, 1.0, self.layout.columns)**(40-i) for i in range(40) ]) print fade_out.shape return (utils.randrange(.4, 1.0, (40, self.layout.columns)) * fade_out)
def transition_period(self, now): return 1 + utils.randrange(-.2, .2)