2024-10-28 17:10:03 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2024-10-28 19:48:28 +00:00
|
|
|
import random
|
2024-10-28 17:10:03 +00:00
|
|
|
import time
|
|
|
|
import math
|
|
|
|
import numpy as np
|
2024-10-28 19:48:28 +00:00
|
|
|
|
2024-10-28 17:10:03 +00:00
|
|
|
# Groesse des Bildschirms bestimmen
|
|
|
|
Nx = int(sys.argv[1])
|
|
|
|
Ny = int(sys.argv[2])
|
|
|
|
|
|
|
|
# Bestimme den Parameter
|
|
|
|
time_ms = 10
|
|
|
|
try:
|
|
|
|
time_ms = int(sys.argv[3])
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Puffer fuer Pixel erstellen und mit 0 initialisieren
|
|
|
|
|
|
|
|
curPixel = 0
|
|
|
|
|
2024-10-28 19:48:28 +00:00
|
|
|
phase = np.random.uniform(0, 2 * np.pi, (Ny, Nx))
|
2024-10-28 17:10:03 +00:00
|
|
|
t = 0
|
|
|
|
f_min = 0.08
|
|
|
|
f_max = 0.10
|
|
|
|
f = np.random.uniform(f_min, f_max, (Ny, Nx))
|
|
|
|
while True:
|
2024-10-28 19:48:28 +00:00
|
|
|
t += time_ms / 1000.0
|
|
|
|
s = 0.80 + 0.2 * np.sin(phase + 2 * np.pi * t * f)
|
2024-10-28 17:10:03 +00:00
|
|
|
img = np.zeros([Ny, Nx, 4])
|
2024-10-28 19:48:28 +00:00
|
|
|
img[:, :, 3] = 255 * s
|
2024-10-28 17:10:03 +00:00
|
|
|
# Zeige den Puffer an
|
2024-10-28 19:48:28 +00:00
|
|
|
out = img.reshape((Nx * Ny * 4,)).astype(np.uint8)
|
2024-10-28 17:10:03 +00:00
|
|
|
os.write(1, out.tobytes())
|
|
|
|
# warte time_ms ms
|
2024-10-28 19:48:28 +00:00
|
|
|
time.sleep(time_ms * 0.001)
|