|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import colorsys
|
|
|
|
import blup.animation
|
|
|
|
import blup.frame
|
|
|
|
import blup.writebml
|
|
|
|
import random
|
|
|
|
|
|
|
|
def getRandomColor(maxval):
|
|
|
|
return list(map(lambda x: int(round(x*maxval)), colorsys.hsv_to_rgb(random.random(), 1, 1)))
|
|
|
|
|
|
|
|
dim = blup.frame.FrameDimension(22, 16, 256, 3)
|
|
|
|
newanim = blup.animation.Animation(dim)
|
|
|
|
|
|
|
|
|
|
|
|
num = 10
|
|
|
|
horiz = True
|
|
|
|
delay = 100
|
|
|
|
for i in range(num):
|
|
|
|
newcolor = getRandomColor(dim.depth - 1)
|
|
|
|
horiz = not horiz
|
|
|
|
if horiz:
|
|
|
|
for x in range(dim.size()[0]):
|
|
|
|
newframe = blup.animation.AnimationFrame(dim, delay)
|
|
|
|
for y in range(dim.size()[1]):
|
|
|
|
newframe.setPixel(x, y, newcolor)
|
|
|
|
newanim.addFrame(newframe)
|
|
|
|
else:
|
|
|
|
for y in range(dim.size()[1]):
|
|
|
|
newframe = blup.animation.AnimationFrame(dim, delay)
|
|
|
|
for x in range(dim.size()[0]):
|
|
|
|
newframe.setPixel(x, y, newcolor)
|
|
|
|
newanim.addFrame(newframe)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blup.writebml.writeBml(newanim, '/tmp/colorwischer.bml')
|