-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-examples.sh
executable file
·50 lines (40 loc) · 1.96 KB
/
generate-examples.sh
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
46
47
48
49
50
#!/bin/sh
set +x
mkdir examples/output-svg/
rm examples/output-svg/*
mkdir examples/output-png/
rm examples/output-png/*
do_cmd () {
DESC=$1;
CMD_ARGS=$2;
OUTPUT=$3;
INPUT=$4;
if [ -z "$INPUT" ]; then
INPUT='examples/input/butterfly.svg';
fi
SVG="examples/output-svg/$OUTPUT.svg"
PNG="examples/output-png/$OUTPUT.png"
CMD="node --experimental-modules lace-maker2.mjs $INPUT --outputTemplate '$SVG' $CMD_ARGS"
echo "## $DESC" >> README.md
echo " $CMD" >> README.md
echo $CMD
echo "important bits:\n" >> README.md
echo " $CMD_ARGS" >> README.md
eval $CMD
convert $SVG $PNG;
echo "![$ARGS]($PNG)" >> README.md
#
}
cp README-base.md README.md
do_cmd 'Triangles with 0 extra points' '--numExtraPoints 0' 'triangles-0'
do_cmd 'Triangles with 10 extra points' '--numExtraPoints 10' 'triangles-10'
do_cmd 'Triangles with 10 extra points + rounding' '--rounded --numExtraPoints 10' 'triangles-rounded-10'
do_cmd 'Triangles with 10 extra points + inner-subtract' '--subtract --numExtraPoints 10' 'triangles-subtract-10'
do_cmd 'Voronoi with 0 extra points' '--voronoi --numExtraPoints 0' 'voronoi-0'
do_cmd 'Voronoi with 10 extra points' '--voronoi --numExtraPoints 10' 'voronoi-10'
do_cmd 'Voronoi with 10 extra points + rounded' '--rounded --voronoi --numExtraPoints 10' 'voronoi-rounded-10'
do_cmd 'Voronoi with 10 extra points + inner subtract' '--voronoi --subtract --numExtraPoints 10' 'voronoi-subtract-10'
do_cmd 'Voronoi with 10 extra points + inner subtract + see debugging' '--voronoi --subtract --debug --numExtraPoints 10' 'voronoi-subtract-debug-10'
do_cmd 'Voronoi with 10 extra points + inner subtract + add pendant hole' '--addHole --voronoi --subtract --numExtraPoints 10' 'voronoi-subtract-hole-10'
do_cmd 'Triangular caterpillar with center hole' '--addHole' 'caterpillar-hole' 'examples/input/caterpillar.svg'
#do_cmd 'Triangular caterpillar with end (butt) hole' '--addHole --butt' 'caterpillar-hole-butt' 'examples/input/caterpillar.svg'