summaryrefslogtreecommitdiffstats
path: root/hyperize.sh
blob: 8ee4a34059e4bc6254b019ab4249f381c9c740fc (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
38
39
40
41
42
43
44
45
#!/bin/sh

source ./shakeoffsets.sh

declare -a shakeOffsets
getShakeOffsets shakeOffsets

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


mkdir -p export_tmp
rm -f export_tmp/*


counter=1
NUMPROCS=8
NUMJOBS="\j"
while [ $counter -le 75 ]
do
    while (( ${NUMJOBS@P} >= NUMPROCS )); do
        wait -n
    done
    offset=${shakeOffsets[counter-1]}
    file=`printf "export_tmp/%s.png" $counter`
    inkscape -z -e $file -a $offset $SOURCESVG &
    ((counter++))
done

wait -n


declare -a args

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

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