44 lines
1.0 KiB
Bash
44 lines
1.0 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
LAST=$1
|
||
|
|
||
|
PI=3.14159265359
|
||
|
FPS=24
|
||
|
MULTIPLE=3
|
||
|
STEP=$(echo "scale=6;360/45" | bc -l)
|
||
|
AMP=1.0
|
||
|
STARTANGLE=270
|
||
|
|
||
|
DOTSIZE_MIN=2
|
||
|
DOTSIZE_MAX=6
|
||
|
DOTSIZE_HALF=`echo "scale=6;($DOTSIZE_MAX - $DOTSIZE_MIN) / 2" | bc`
|
||
|
DOTSIZE=`echo "scale=6;($DOTSIZE_MIN + $DOTSIZE_HALF)" | bc`
|
||
|
DOTSIZE_MULTIPLE=$DOTSIZE_HALF
|
||
|
|
||
|
PARTICLES_MIN=300
|
||
|
PARTICLES_MAX=550
|
||
|
PARTICLES_HALF=`echo "($PARTICLES_MAX - $PARTICLES_MIN) / 2" | bc`
|
||
|
PARTICLES=$((PARTICLES_MIN+PARTICLES_HALF))
|
||
|
PARTICLES_MULTIPLE=$PARTICLES_HALF
|
||
|
|
||
|
fluctuation () {
|
||
|
i=$1
|
||
|
ANGLE=$(echo "scale=6;$STARTANGLE+($i * $STEP)" | bc)
|
||
|
FLUCTUATION=$(echo "scale=6;s($ANGLE*($PI/180))*$AMP" | bc -l)
|
||
|
echo $FLUCTUATION
|
||
|
}
|
||
|
|
||
|
i=0
|
||
|
|
||
|
while [ $i -lt $LAST ]; do
|
||
|
FLUCTUATION=$(fluctuation $i)
|
||
|
REALTIME=$(echo "scale=1;($i*$MULTIPLE)/$FPS" | bc -l)
|
||
|
echo "[${i}] $((i*MULTIPLE)) $REALTIME: ${FLUCTUATION}"
|
||
|
fluc=`fluctuation $i`
|
||
|
particles=`echo "scale=0;($PARTICLES-($fluc*$PARTICLES_MULTIPLE))/1" | bc`
|
||
|
dotsize=`echo "scale=6;$DOTSIZE+($fluc*$DOTSIZE_MULTIPLE)" | bc`
|
||
|
echo $fluc
|
||
|
echo $particles
|
||
|
echo $dotsize
|
||
|
i=$((i+1))
|
||
|
done
|