animation wip

This commit is contained in:
Marcus 2024-01-06 14:17:40 +01:00
parent f5ec4fe401
commit 6641771171

View file

@ -37,7 +37,20 @@ test -z "$BOUNCESTEP" && BOUNCESTEP=2
# /dev/shm/foo to store frame counter # /dev/shm/foo to store frame counter
# #
# GifFileFormat - gif, jpg, png || detect which fileformat IMGFILE is # GifFileFormat - gif, jpg, png || detect which fileformat IMGFILE is
test -z "$ANIMATION" && ANIMATION="false" #test -z "$ANIMATION" && ANIMATION="false"
#
# loadLOL loads every single frame into an array field WHEN ANIMATION is true
# loadLOL sets No of frames in LOLFIELDS
#
# flootworker looks in while loop which value in /dev/shm/frametick is.
# /dev/shm/frametick contains which frame from LOL to draw.
# function frametick() gets started in background when ANIMATION is true
# and gets started before the flootworker get started
# frametick writes the no of frame to draw into /dev/shm/frametick
# to not draw too fast, there is a sleep in frametick which waits for
# FRAMETICKTIME seconds. Values are float, down to lowest value 0.001
# Only one of ANIMATION or LARGE can be true, not both.
FRAMETICK_SHM="/dev/shm/frametick"
## END ANIMATION ## END ANIMATION
@ -287,6 +300,16 @@ xymode() {
} }
frametick() {
test -z "$FRAMETICKTIME" && FRAMETICKTIME=0.1
while true
do
echo lol
exit 1
done
}
flootworker() flootworker()
{ {
while true while true
@ -428,8 +451,14 @@ floot() {
;; ;;
esac esac
message "starting $FLOOTFORKS workers"
if [ $ANIMATION ]
then
frametick &
fi
message "starting ${YELLOW}${FLOOTFORKS}${ENDCOLOR} workers"
while true while true
do do
@ -439,7 +468,7 @@ floot() {
if [ -z ${LOLPID[$i]} ] || ! ps -p ${LOLPID[$i]} > /dev/null if [ -z ${LOLPID[$i]} ] || ! ps -p ${LOLPID[$i]} > /dev/null
then then
message "worker ${YELLOW}$i${ENDCOLOR} is not running, starting it" message "worker ${YELLOW}$i${ENDCOLOR} is not running, starting it"
if [ $LARGE ] if [ $LARGE ] || [ $ANIMATION ]
then then
flootworker $LOLFIELDS & flootworker $LOLFIELDS &
LOLPID[$i]=$! LOLPID[$i]=$!
@ -503,11 +532,19 @@ case $1 in
;; ;;
esac esac
if ! command -v convert > /dev/null if ! command -v convert > /dev/null
then then
message error "${YELLOW}convert${ENDCOLOR} not found" message error "${YELLOW}convert${ENDCOLOR} not found"
exit 1 exit 1
fi fi
if [ $LARGE ] && [ $ANIMATION ]
then
message error "${YELLOW}LARGE${ENDCOLOR} and ${YELLOW}ANIMATION${ENDCOLOR} cannot be used at the same time. Please use only one of them."
exit 1
fi
message "all requirements satisfied ${GREEN}:)${ENDCOLOR}" message "all requirements satisfied ${GREEN}:)${ENDCOLOR}"
floot floot
;; ;;