Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
c3pb
Rc3 21 Animation
Commits
ba6436b1
Unverified
Commit
ba6436b1
authored
Dec 26, 2021
by
Peter Wagener
Browse files
aligned animations with start time, added one-shot animation support
parent
330d32c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
anim/__init__.py
anim/__init__.py
+1
-1
anim/core.py
anim/core.py
+14
-6
No files found.
anim/__init__.py
View file @
ba6436b1
from
.core
import
animation
,
Pixels
,
run
from
.core
import
animation
,
Pixels
,
run
,
AnimationCompleted
anim/core.py
View file @
ba6436b1
...
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment