reorganize things i guess
This commit is contained in:
parent
4e13c1e1a6
commit
ebf21954d2
2 changed files with 50 additions and 45 deletions
|
@ -8,11 +8,11 @@ pixelfloot was built during the 37c3. in its actual state, its just a mess. I ho
|
||||||
## examples
|
## examples
|
||||||
|
|
||||||
- Display image: `./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
- Display image: `./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
||||||
- set position: `W=1337 H=420 ./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
- set position: `X=1337 Y=420 ./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
||||||
- image random position: `./pixelfloot_bash.sh floot images/lucky-cat.jpg chaos`
|
- image random position: `./pixelfloot_bash.sh floot images/lucky-cat.jpg chaos`
|
||||||
- wider "chaos-radio": `W=1000 H=600 ./pixelfloot_bash.sh floot images/lucky-cat.jpg chaos`
|
- wider "chaos-radio": `X_MAX=1000 Y_MAX=600 ./pixelfloot_bash.sh floot images/lucky-cat.jpg chaos`
|
||||||
- image shake position: `./pixelfloot_bash.sh floot images/lucky-cat.jpg shake`
|
- image shake position: `./pixelfloot_bash.sh floot images/lucky-cat.jpg shake`
|
||||||
- set the position : `W=420 H=420 ./pixelfloot_bash.sh floot images/lucky-cat.jpg shake`
|
- set the position : `X=420 Y=420 ./pixelfloot_bash.sh floot images/lucky-cat.jpg shake`
|
||||||
- image bounce across screen: `./pixelfloot_bash.sh floot images/lucky-cat.jpg bounce`
|
- image bounce across screen: `./pixelfloot_bash.sh floot images/lucky-cat.jpg bounce`
|
||||||
- can set the "bounce-radius": `X_MAX=1000 Y_MAX=500 ./pixelfloot_bash.sh floot images/lucky-cat.jpg bounce`
|
- can set the "bounce-radius": `X_MAX=1000 Y_MAX=500 ./pixelfloot_bash.sh floot images/lucky-cat.jpg bounce`
|
||||||
- move image with your cursor (needs `xdotool`): `./pixelfloot_bash.sh floot images/lucky-cat.jpg cursor`
|
- move image with your cursor (needs `xdotool`): `./pixelfloot_bash.sh floot images/lucky-cat.jpg cursor`
|
||||||
|
|
|
@ -21,13 +21,15 @@ FLOOTSRUNNING=0
|
||||||
|
|
||||||
test -z "$FLOOTFORKS" && FLOOTFORKS="2"
|
test -z "$FLOOTFORKS" && FLOOTFORKS="2"
|
||||||
|
|
||||||
|
test -z $X_MAX && X_MAX=800
|
||||||
|
test -z $Y_MAX && Y_MAX=600
|
||||||
|
test -z $X && X=0
|
||||||
|
test -z $Y && Y=0
|
||||||
|
|
||||||
## bounce
|
## bounce
|
||||||
SX=0
|
|
||||||
SY=0
|
|
||||||
XDIR=0
|
XDIR=0
|
||||||
YDIR=0
|
YDIR=0
|
||||||
BOUNCESTEP=2
|
BOUNCESTEP=2
|
||||||
|
|
||||||
## end bounce
|
## end bounce
|
||||||
|
|
||||||
declare -a PIXMAP
|
declare -a PIXMAP
|
||||||
|
@ -229,14 +231,10 @@ convertimg() {
|
||||||
|
|
||||||
xymode() {
|
xymode() {
|
||||||
case $SHUFMODE in
|
case $SHUFMODE in
|
||||||
chaos) test -z $H && H=640
|
chaos) OFFSET="OFFSET $(shuf -i 0-$X_MAX -n 1) $(shuf -i 0-$Y_MAX -n 1)"
|
||||||
test -z $W && W=480
|
|
||||||
OFFSET="OFFSET $(shuf -i 0-$W -n 1) $(shuf -i 0-$H -n 1)"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
shake) test -z $H && H=0
|
shake) OFFSET="OFFSET $(shuf -i $X-$(($X+10)) -n 1) $(shuf -i $Y-$(($Y+10)) -n 1)"
|
||||||
test -z $W && W=0
|
|
||||||
OFFSET="OFFSET $(shuf -i $W-$(($W+10)) -n 1) $(shuf -i $H-$(($H+10)) -n 1)"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cursor) OFFSET="OFFSET $(xdotool getmouselocation | tr ':' ' '|awk '{print $2 " " $4}')"
|
cursor) OFFSET="OFFSET $(xdotool getmouselocation | tr ':' ' '|awk '{print $2 " " $4}')"
|
||||||
|
@ -250,32 +248,31 @@ xymode() {
|
||||||
# 0 means up, 1 means down
|
# 0 means up, 1 means down
|
||||||
#
|
#
|
||||||
# handled outsite, in the flootworker()
|
# handled outsite, in the flootworker()
|
||||||
test -z $X_MAX && X_MAX=800
|
|
||||||
test -z $Y_MAX && Y_MAX=600
|
|
||||||
|
|
||||||
if [ $XDIR == 0 ]
|
if [ $XDIR == 0 ]
|
||||||
then
|
then
|
||||||
SX=$(($SX+$BOUNCESTEP))
|
X=$(($X+$BOUNCESTEP))
|
||||||
test $SX -ge $X_MAX && XDIR=1
|
test $X -ge $X_MAX && XDIR=1
|
||||||
else
|
else
|
||||||
SX=$(($SX-$BOUNCESTEP))
|
X=$(($X-$BOUNCESTEP))
|
||||||
test $SX -eq 0 && XDIR=0
|
test $X -eq 0 && XDIR=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $YDIR == 0 ]
|
if [ $YDIR == 0 ]
|
||||||
then
|
then
|
||||||
SY=$(($SY+$BOUNCESTEP))
|
Y=$(($Y+$BOUNCESTEP))
|
||||||
test $SY -ge $Y_MAX && YDIR=1
|
test $Y -ge $Y_MAX && YDIR=1
|
||||||
else
|
else
|
||||||
SY=$(($SY-$BOUNCESTEP))
|
Y=$(($Y-$BOUNCESTEP))
|
||||||
test $SY -eq 0 && YDIR=0
|
test $Y -eq 0 && YDIR=0
|
||||||
fi
|
fi
|
||||||
OFFSET="OFFSET $SX $SY"
|
OFFSET="OFFSET $X $Y"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
static|*) test -z $H && H=0
|
static|*) test -z $X && X=0
|
||||||
test -z $W && W=0
|
test -z $Y && Y=0
|
||||||
OFFSET="OFFSET $W $H"
|
OFFSET="OFFSET $X $Y"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
|
@ -352,15 +349,12 @@ floot() {
|
||||||
fill)
|
fill)
|
||||||
message "generating color field with ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
|
message "generating color field with ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
|
||||||
LOL_org="$(gen_field)"
|
LOL_org="$(gen_field)"
|
||||||
for i in $(seq 1 $FLOOTFORKS)
|
loadLOL
|
||||||
do
|
|
||||||
LOL[$i]="$LOL_org"
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
""|text)
|
""|text)
|
||||||
test -z "$TEXT" && TEXT="$0"
|
test -z "$TEXT" && TEXT="$0"
|
||||||
test -z "$TEXTSIZE" && TEXTSIZE=42
|
test -z "$FONTSIZE" && FONTSIZE=42
|
||||||
test -z "$COLOR" && COLOR="000000"
|
test -z "$COLOR" && COLOR="000000"
|
||||||
test -z "$BGCOLOR" && BGCOLOR="FFFFFF"
|
test -z "$BGCOLOR" && BGCOLOR="FFFFFF"
|
||||||
|
|
||||||
|
@ -370,8 +364,8 @@ floot() {
|
||||||
|
|
||||||
fi
|
fi
|
||||||
#convert -fill lightgreen -background white -pointsize 40 caption:"KARTTUR" -quality 72 DstImage.png
|
#convert -fill lightgreen -background white -pointsize 40 caption:"KARTTUR" -quality 72 DstImage.png
|
||||||
message "generating text, size $TEXTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
|
message "generating text, size $FONTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
|
||||||
LOL_org="$(convert ${SIZE} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${TEXTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')"
|
LOL_org="$(convert ${SIZE} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${FONTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')"
|
||||||
|
|
||||||
loadLOL
|
loadLOL
|
||||||
;;
|
;;
|
||||||
|
@ -449,11 +443,11 @@ case $1 in
|
||||||
;;
|
;;
|
||||||
|
|
||||||
floot) message "flooting ${YELLOW}${IPFLOOT}:${FLOOTPORT}${ENDCOLOR}"
|
floot) message "flooting ${YELLOW}${IPFLOOT}:${FLOOTPORT}${ENDCOLOR}"
|
||||||
if [ "$SHUFMODE" == "static" ] && ([ -z "$W" ] && [ -z "$H" ])
|
#~ if [ "$SHUFMODE" == "static" ] && ([ -z "$X" ] && [ -z "$Y" ])
|
||||||
then
|
#~ then
|
||||||
echo "please specify coords with e.g. 'W=420 H=420 SHUFMODE=static $0 floot $FNAME" >&2
|
#~ echo "please specify coords with e.g. 'W=420 H=420 SHUFMODE=static $0 floot $FNAME" >&2
|
||||||
exit 1
|
#~ exit 1
|
||||||
fi
|
#~ fi
|
||||||
#~ message "request board size from ${YELLOW}${IPFLOOT}:${FLOOTPORT}${ENDCOLOR}"
|
#~ message "request board size from ${YELLOW}${IPFLOOT}:${FLOOTPORT}${ENDCOLOR}"
|
||||||
#~ exec 5<>/dev/tcp/$IPFLOOT/$FLOOTPORT
|
#~ exec 5<>/dev/tcp/$IPFLOOT/$FLOOTPORT
|
||||||
#~ echo "SIZE" >&5
|
#~ echo "SIZE" >&5
|
||||||
|
@ -486,17 +480,28 @@ case $1 in
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$0 [floot|convertimg] [FILENAME|fill|text] ([MODE])"
|
echo "$0 [floot|convertimg] [FILENAME|fill|text] ([MODE])"
|
||||||
echo "MODE: static (env \$H and \$W for position)"
|
echo ""
|
||||||
echo " chaos (env \$H and \$W for position range)"
|
echo "floot: flooting the target specified with IPFLOOT"
|
||||||
echo " shake (env \$H and \$W for position range)"
|
echo "convertimg: converts an image to a command list file in /tmp"
|
||||||
|
echo " to use it, start 'USECACHE=true $0 floot [FILENAME]', where FILENAME"
|
||||||
|
echo " is the original image file."
|
||||||
|
echo ""
|
||||||
|
echo "FILENAME: path to any picture imagemagick can handle"
|
||||||
|
echo "fill: create a filled area with (env COLOR, W (width), H (height), X, Y)"
|
||||||
|
echo "text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR)"
|
||||||
|
echo ""
|
||||||
|
echo "MODE: static (env \$X and \$Y for position)"
|
||||||
|
echo " chaos (env \$X_MAX and \$Y_MAX for position range)"
|
||||||
|
echo " shake (env \$X and \$Y for position range)"
|
||||||
echo " cursor"
|
echo " cursor"
|
||||||
echo " bounce (env \$Y_MAX and \$X_MAX for max bounce range)"
|
echo " bounce (env \$Y_MAX and \$X_MAX for max bounce range)"
|
||||||
echo ""
|
echo ""
|
||||||
echo "available env vars to configure:"
|
echo "available env vars to configure:"
|
||||||
echo "RESIZE(int), ALPHACOLOR(hex), FLOOTFORKS(int), H(int), W(int)"
|
echo "IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int)"
|
||||||
echo "SIZE(int), TEXT(string), TEXTSIZE(int), BGCOLOR(hex), COLOR(hex)"
|
echo "SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex)"
|
||||||
echo "X_MAX(int), Y_MAX(int)"
|
echo "X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)"
|
||||||
echo "IPFLOOT(string), FLOOTPORT(string), USECACHE(bool)"
|
echo "RESIZE(int), ALPHACOLOR(hex)"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue