40 lines
793 B
Python
Executable File
40 lines
793 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import random
|
|
import time
|
|
import math
|
|
import numpy as np
|
|
|
|
# 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
|
|
|
|
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)
|
|
img = np.zeros([Ny, Nx, 4])
|
|
img[:, :, 3] = 255 * s
|
|
# Zeige den Puffer an
|
|
out = img.reshape((Nx * Ny * 4,)).astype(np.uint8)
|
|
os.write(1, out.tobytes())
|
|
# warte time_ms ms
|
|
time.sleep(time_ms * 0.001)
|