Unverified Commit ba6436b1 authored by Peter Wagener's avatar Peter Wagener
Browse files

aligned animations with start time, added one-shot animation support

parent 330d32c8
from .core import animation, Pixels, run
from .core import animation, Pixels, run, AnimationCompleted
......@@ -115,6 +115,9 @@ def _(host: str, port: int):
mqttProxy = (host, port)
class AnimationCompleted(Exception):
pass
def run():
cli.process()
......@@ -146,16 +149,21 @@ def run():
pixels.pixmap = pixmaps.dode_matrix
t0 = time.time()
tstart = t0
while True:
t1 = time.time()
dt = t1 - t0
t0 = t1
anim(dt,t1, pixels)
if not fDisplay.value or fTerminal.value:
pixels.render_terminal()
if fDisplay.value:
pixels.render_mqtt(mqtt_client)
try:
anim(dt, t1 - tstart, pixels)
if not fDisplay.value or fTerminal.value:
pixels.render_terminal()
if fDisplay.value:
pixels.render_mqtt(mqtt_client)
except AnimationCompleted:
break
delay = 1 / 60 - dt
if delay > 0: time.sleep(delay)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment