Code cleanup

This commit is contained in:
T
2024-10-28 20:48:28 +01:00
parent 8dc0480c18
commit c38a840d42
3 changed files with 283 additions and 228 deletions

View File

@ -2,10 +2,11 @@
import os
import sys
import random
import random
import time
import math
import numpy as np
# Groesse des Bildschirms bestimmen
Nx = int(sys.argv[1])
Ny = int(sys.argv[2])
@ -21,18 +22,18 @@ except:
curPixel = 0
phase = np.random.uniform(0, 2*np.pi, (Ny, Nx))
phase = np.random.uniform(0, 2 * np.pi, (Ny, Nx))
t = 0
f_min = 0.08
f_max = 0.10
f = np.random.uniform(f_min, f_max, (Ny, Nx))
while True:
t += time_ms/1000.0
s = 0.80 +0.2*np.sin(phase+2*np.pi*t*f)
t += time_ms / 1000.0
s = 0.80 + 0.2 * np.sin(phase + 2 * np.pi * t * f)
img = np.zeros([Ny, Nx, 4])
img[:,:,3] = 255*s
img[:, :, 3] = 255 * s
# Zeige den Puffer an
out = img.reshape((Nx*Ny*4,)).astype(np.uint8)
out = img.reshape((Nx * Ny * 4,)).astype(np.uint8)
os.write(1, out.tobytes())
# warte time_ms ms
time.sleep(time_ms*0.001)
time.sleep(time_ms * 0.001)