Skip to content

Commit

Permalink
Added another rainbow animation which shifts columns
Browse files Browse the repository at this point in the history
  • Loading branch information
seelmann committed Jul 23, 2014
1 parent be77663 commit 3e2101d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions animations/rainbowshift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from acabsl import send
from acabsl import update
import acabsl

import colorsys
import random
import time

tick = 0.1

def setcol(cols, time):
for x in range(0,acabsl.WALLSIZEX):
r,g,b = colorsys.hsv_to_rgb(cols[x], 1., 1.)
for y in range(0,acabsl.WALLSIZEY):
send(x,y,r*255,g*255,b*255,time);
update()

def shift(l,n):
return l[n:] + l[:n]

h = 0
cols = []
for i in range(0,acabsl.WALLSIZEX):
cols.append(0)
update()
while 1:
h += random.gauss(0.02,0.05)
h = h % 1.

cols = shift(cols,-1)
cols[0] = h

setcol(cols, tick*3)

time.sleep(tick)


0 comments on commit 3e2101d

Please sign in to comment.