#!/bin/bash

for f in sim-*.png
do
	convert $f -trim +repage -bordercolor white -border 10 -resize 640x282! `basename $f .png`.gif
	# rm -f $f
done

rm -f sim-*.png

gifsicle --colors 256 --optimize --delay 12 --loopcount=0 sim-*.gif > dam.gif

rm -f sim-*.gif

animate dam.gif
