summaryrefslogtreecommitdiffstats
path: root/animate.sh
blob: 3d0bfc99853c91ead608f770a2b43fbefbc15c7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env sh

SOURCEBASE=$1
MAX=$2
DELAY=$3
SOURCESVG=`printf "%s.svg" $SOURCEBASE`
TARGETSVG=`printf "export/%s.png" $SOURCEBASE`


mkdir -p export_tmp
rm -f export_tmp/*


counter=1
while [ $counter -le $MAX ]
do
    source=`printf "%s%s.svg" $SOURCEBASE $counter`
    file=`printf "export_tmp/%s_raw.png" $counter`
    filecomp=`printf "export_tmp/%s.png" $counter`
    inkscape -o $file $source
    pngquant -o $filecomp $file
    ((counter++))
done


declare -a args

counter=1
while [ $counter -le $MAX ]
do
    file=`printf "export_tmp/%s.png" $counter`
    args+=($file $DELAY)
    ((counter++))
done

apngasm -o $TARGETSVG ${args[@]}
#rm -f export_tmp/*