Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wyolum Cube Animation
from matrix_animations import *
class WyoCubeBloom(BaseMatrixAnim):
def __init__(self, led, dir = True):
super(WyoCubeBloom, self).__init__(led)
self._vector = genVector(16, 16)
self._dir = dir
self._panelOffset = [0,8,16,24,32,40]
def step(self, amt = 8):
if self._dir:
s = 255 - self._step
else:
s = self._step
h = 8
w = 8
span = 8*2
for y in range(h):
for x in range(w):
#Top Corner
a = colors.hue_helper(self._vector[y+8][x], span, s)
self._led.set(self._panelOffset[4]+x, y, a)
b = colors.hue_helper(self._vector[y+8][x], span, s)
self._led.set(self._panelOffset[1]+x, y, b)
c = colors.hue_helper(self._vector[y+8][x+8], span, s)
self._led.set(self._panelOffset[2]+x, y, c)
#Bottom Corner
d = colors.hue_helper(self._vector[y+8][x]+6, span, s)
self._led.set(self._panelOffset[0]+x, y, d)
e = colors.hue_helper(self._vector[y+8][x+8]+6, span, s)
self._led.set(self._panelOffset[3]+x, y, e)
f = colors.hue_helper(self._vector[y+8][x+8]+6, span, s)
self._led.set(self._panelOffset[5]+x, y, f)
self._step += amt
if(self._step >= 255):
self._step = 0
from bibliopixel import *
log.setLogLevel(log.DEBUG)
numDisplays = 6
from bibliopixel.drivers.serial_driver import *
driver = DriverSerial(num=8*8*numDisplays, type = LEDTYPE.NEOPIXEL, c_order = ChannelOrder.GRB)
#load the LEDMatrix class
from bibliopixel.led import *
maps = []
for i in range(numDisplays):
maps.append(mapGen(width=8, height=8,
rotation = MatrixRotation.ROTATE_0,
vert_flip = True, serpentine=False))
build = MultiMapBuilder()
build.addRow(*maps)
#change rotation and vert_flip as needed by your display
led = LEDMatrix(driver, width=8*numDisplays, height=8, coordMap=build.map)
led.setMasterBrightness(32)
try:
#anim.run()
anim = WyoCubeBloom(led)
anim.run(amt=6, fps=30)
except KeyboardInterrupt:
led.all_off()
led.update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.