Пример #1
0
    def run(self):
        for i, color in enumerate(self.particles):
            if random.random() < self.chance:
                if self.particles[i] <= 10:
                    self.particles[i] = 511
            elif color > 256 + 128 + 64:
                self.particles[i] -= 1
                self.frame.brightness[(i // 8)][(i % 8)][:] = [
                    int(f) for f in self.colormap[0] * (-color + 512.) / 64.
                ]
            elif color > 256:
                self.particles[i] -= 1
                self.frame.brightness[(i // 8)][(i % 8)][:] = [
                    int(f) for f in self.colormap[448 - color]
                ]
            elif color >= 128:
                self.particles[i] -= 1
                self.frame.brightness[i // 8][i % 8][:] = [
                    int(f) for f in self.colormap[255] * (color - 128.) / 128.
                ]
            elif color > 0:
                self.particles[i] -= 1
                self.frame.brightness[i // 8][i % 8][:] = [0, 0, 0]
        shytlight.add_frame(self.rep, self.frame)


shytlight.init_shitlight()
star = shooting_star()
while (True):
    star.run()
Пример #2
0
import shytlight_simulator as shytlight
import time
import numpy as np

# initialize threads
shytlight.init_shitlight()

# Be sure to create the array with the right dimension (5,8,3). Color values go from 0..255
# Behaviour for floating types is currently untested!
color_test = np.zeros((5,8,3))
for j in range(5):
  for i in range(8):
    color_test[j,i,1] = 0xff
 
shytlight.add_frame(100, color_test)
time.sleep(10)

Пример #3
0
def show_menu():
    shytlight.init_shitlight()
    loop.widget = top