You’re really meant to load animations from the yaml based “project” files. In which you write an animation class and then call it via the yaml project file like this:
shape: [64, 7]
animation:
typename: $bpa.matrix.Text.ScrollText
color: orange
text: 'Getting Started'
But if you want to do it all in python you still can, like below:
#load the AllPixel driver. Works for Strip AND Matrix
from bibliopixel.drivers.serial import *
driver = Serial(num = 8*8, ledtype = LEDTYPE.WS2812B)
#import the bibliopixel base classes
from bibliopixel import *
from bibliopixel.animation import *
class BasicAnimTest(BaseStripAnim):
def __init__(self, led):
super(BasicAnimTest, self).__init__(led)
#do any initialization here
def step(self, amt = 1):
for i in range(8*8):
self._led.set(i, colors.hue2rgb((i*4+self._step)%256))
self._step += amt
#Now try with Strip
led = Strip(driver)
try:
anim = BasicAnimTest(led)
anim.run(fps=45)
except KeyboardInterrupt:
#turn everything off if Ctrl+C is pressed
led.all_off()
led.update()