コード例 #1
0
        for pixel in self.pixels:
            display.set_pixel(pixel[1], pixel[2], HSVColor(pixel[0], 1.0, 1.0))
            pixel[0] += 0.002
            if pixel[0] > 1.0:
                pixel[0] = 0.0

            if abs(pixel[0] - bg_hue) < 0.01:
                pixel[0] = bg_hue + 0.03
                pixel[1] = random.randint(0, 7)
                pixel[2] = random.randint(0, 7)

        self.frame += 1


class AnimArrow:
    def __init__(self):
        self.display = Display(7, 7)
        self.display.fill(HSVColor(0.7, 1.0, 0.4))

    def paint(self, display: Display, bg_hue: float):
        display.copy_region_from(self.display)


animation = AnimTwo()

while True:
    d.fill(Color.convert(hsv))
    animation.paint(d, hsv.hue)
    d.update()
    hsv.h += 0.001
コード例 #2
0
ファイル: tetris-test.py プロジェクト: FirstKlaas/LEDWall
from ledwall.components import (Display, UDPSender, HSVColor)
from ledwall.games.tetris import Tetris

display = Display(7,7,UDPSender(server='192.168.178.96'))
game = Tetris(display)

bg = HSVColor(0.0,1.0,0.4)
hueDelta = 0.01

while True:
	display.fill(bg)
	game.drawPiece(game.get_new_piece())
	display.update()
	bg._h += hueDelta