Expand browser editor runtime and LED simulation workflows.
Add Docker deployment support, richer Selenium/LED pattern tests, in-browser diagnostics, responsive UI improvements, and 16x16 panel simulation tooling to speed iteration and hardware-style prototyping. Made-with: Cursor
This commit is contained in:
37
workspace/code/panel16_matrix_rain.py
Normal file
37
workspace/code/panel16_matrix_rain.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""16x16 matrix-style rain animation."""
|
||||
|
||||
from machine import Pin
|
||||
import neopixel
|
||||
import random
|
||||
import time
|
||||
|
||||
from panel16_utils import PANEL_H, PANEL_W, clamp8, xy_to_index
|
||||
|
||||
|
||||
np = neopixel.NeoPixel(Pin(4), PANEL_W * PANEL_H)
|
||||
rng = random.Random(42)
|
||||
|
||||
heads = [rng.randrange(-PANEL_H, 0) for _ in range(PANEL_W)]
|
||||
|
||||
for _frame in range(320):
|
||||
for y in range(PANEL_H):
|
||||
for x in range(PANEL_W):
|
||||
np[xy_to_index(x, y)] = (0, 0, 0)
|
||||
|
||||
for x in range(PANEL_W):
|
||||
heads[x] += 1
|
||||
if heads[x] > PANEL_H + 6:
|
||||
heads[x] = rng.randrange(-PANEL_H, 0)
|
||||
|
||||
head_y = heads[x]
|
||||
for tail in range(8):
|
||||
y = head_y - tail
|
||||
if 0 <= y < PANEL_H:
|
||||
brightness = clamp8(255 - tail * 36)
|
||||
np[xy_to_index(x, y)] = (0, brightness, 0)
|
||||
|
||||
np.write()
|
||||
time.sleep(0.045)
|
||||
|
||||
np.fill((0, 0, 0))
|
||||
np.write()
|
||||
Reference in New Issue
Block a user