1#!/bin/bash
2
3# arc central angle in degrees
4arc_size="64.5"
5
6arc_start=$(bc -l <<< "90 - $arc_size / 2")
7arc_end=$(bc -l <<< "90 + $arc_size / 2")
8
9N=100
10for ((i=0; i < $N; i++)); do
11	progress=$(bc -l <<< "$i / ($N - 1)")
12	fg_arc_start=$(bc -l <<< "$arc_end - $progress * $arc_size")
13
14	filename="progress$(printf "%02d" $i).png"
15	echo "-- Writing file: $filename"
16
17	convert -size 400x400 xc:black \
18		-draw "stroke-linecap round stroke-width 8 \
19				stroke gray ellipse 200,200 100,100 $arc_start,$arc_end \
20				stroke white ellipse 200,200 100,100 $fg_arc_start,$arc_end" "$filename"
21
22  echo "-- Writing file: rtl_$filename"
23  convert -size 400x400 xc:black \
24  		-draw "stroke-linecap round stroke-width 8 \
25  				stroke gray ellipse 200,200 100,100 $arc_start,$arc_end \
26  				stroke white ellipse 200,200 100,100 $fg_arc_start,$arc_end" "rtl_$filename"
27
28		mogrify -crop 120x30+140+280 "$filename"
29		mogrify -crop 120x30+140+280 "rtl_$filename"
30
31		# Use color format recovery can use
32		mogrify -define png:format=png24 -type TrueColor "$filename"
33    mogrify -define png:format=png24 -type TrueColor "rtl_$filename"
34
35		mogrify -flop "rtl_$filename"
36done
37