I am generating a progress circle with 56% as shown below as an example.
I am trying to create a bash script to generate 101 progress circle svgs ranging from 0 till 100. That is from 0% to 100% filled circles.
But it seems to not work, the progress bar for calc does not update. What is the problem here?
.content{
--val: 0;
}
svg {
transform: rotate(-90deg);
}
.percent {
stroke-dasharray: 100;
stroke-dashoffset: calc(100 - var(--val));
}
.val {
--val: 0;
}
<svg width="120" height="120" viewBox="0 0 120 120">
<circle cx="60" cy="60" r="54" fill="none" stroke="#e6e6e6" stroke-width="12" />
<circle style="--val: 56" class="percent val" cx="60" cy="60" r="54" fill="none" stroke="#f77a52" stroke-width="12" pathLength="100" />
</svg>
PROGRESS="0"
while [ $PROGRESS -lt 100 ]
do
cat <<EOS > Image/progress-circle-$PROGRESS.svg
<svg width="120" height="120" viewBox="0 0 120 120" style="$PROGRESS: 0; transform: rotate(-90deg);">
<circle cx="60" cy="60" r="54" fill="none" stroke="#e6e6e6" stroke-width="12" />
<circle style="stroke-dasharray: 100; stroke-dashoffset: calc(100 - $PROGRESS)" cx="60" cy="60" r="54" fill="none" stroke="#f77a52" stroke-width="12" pathLength="100" />
</svg>
EOS
PROGRESS=$[$PROGRESS+1]
done