#!/bin/bash ANGLE=0 # angle of the pictures in the first file COUNT=1 # number to start with to call the original files (usually not changed) ETOTAL=400 # total number of end files YVALUE=-1 # angle of the pictures in the first file FLIP=201 # number of images it takes to complete one flip OTOTAL=250 # Total number of original files COUNT2=1 # number to start naming the files with # calls up the names of the original files while [ $COUNT -le $OTOTAL ]; do if [ $COUNT -lt $OTOTAL ]; then VAR=`printf "%03d" $COUNT` elif [ $COUNT -eq $OTOTAL ]; then COUNT=0 VAR=$OTOTAL fi # repage to put the center of the rotation in the middle of the original picture. use $angle to calculate affine rotation. # crop creates pal background. Changing the $yvalue makes the animation flip head over heals convert $VAR.jpg -affine `affine_distort 180,144 1,$YVALUE $ANGLE 360,288` -transform -crop 720x576+0+0\! -background white -flatten test/$VAR2.jpg echo $VAR let COUNT=COUNT+1 # calculates the current angle of the animation so that it spins 360 degrees ANGLE=$(echo "scale=2; $ANGLE + 360 / $ETOTAL" | bc) # counts from -1 to 1 and back. changes the yvalue of the images to create the flip effect. # the value in the parenthesis comes from the difference from -1 to 1 and half of the number of files # because the sequence is fliped back to the original position if [ $COUNT2 -lt $FLIP ]; then YVALUE=$(echo "scale=2; $YVALUE + ( 2 / ( $ETOTAL / 2 )" | bc) elif [ $COUNT2 -ge $FLIP ]; then YVALUE=$(echo "scale=2; $YVALUE - ( 2 / ( $ETOTAL / 2 )" | bc) fi # gives the file names if [ $COUNT2 -le $ETOTAL ]; then VAR2=`printf "%04d" $COUNT2` elif [ $COUNT2 -gt $ETOTAL ]; then break fi let COUNT2=COUNT2+1 done