mandelbrot/run

53 lines
1.5 KiB
Text
Raw Normal View History

2011-12-14 16:44:31 +00:00
#!/usr/bin/env zsh
nbcore=4
2011-12-14 16:44:31 +00:00
# arguments are:
# width nb pixels
# height nb pixels
# nb of iterations
# x position
# y position
# with of the window
# \rm -f mandel.png && ./mandelbrot 500 200 256 -1.351 0.06 0.0005 mandel.png
2013-03-06 11:29:30 +00:00
dir=stillimages
[[ ! -e $dir ]] && mkdir $dir
old=( $dir/*(.N) )
(( $#old > 0 )) && {
print -- "cleaning..."
\rm -f $dir/*(.)
}
2011-12-14 16:44:31 +00:00
# posx=-1.2535555
# posy=0.3845245
posx=-1.7685736563152709932817429153295447129341200534055498823375111352827765533646353820119779335363321986478087958745766432300344486098206084588445291690832853792608335811319613234806674959498380432536269122404488847453646628324959064543
posy=-0.0009642968513582800001762427203738194482747761226565635652857831533070475543666558930286153827950716700828887932578932976924523447497708248894734256480183898683164582055541842171815899305250842692638349057118793296768325124255746563
2011-12-14 16:44:31 +00:00
liste=()
2013-03-06 11:29:30 +00:00
i=1
width=8.0
imgheight=720
2013-03-06 16:40:48 +00:00
imgwidth=$((imgheight*16/10))
while ((width>0.0000000000001)); do
2013-03-06 16:40:48 +00:00
fic=$(printf "$dir/m-%04d.png" $i)
2011-12-14 16:44:31 +00:00
\rm -f $fic
PREPARAMS="$imgwidth $imgheight 1000 $posx $posy $width $fic"
2011-12-14 16:44:31 +00:00
print ./mandelbrot $PREPARAMS
eval ./mandelbrot +RTS -N$nbcore -RTS $PREPARAMS
2011-12-14 16:44:31 +00:00
(($?>0)) && exit 0
liste=( $liste $fic )
(( width *= 0.97 ))
2013-03-06 11:29:30 +00:00
((i++))
2011-12-14 16:44:31 +00:00
done
2013-03-06 11:57:09 +00:00
cmd=avconv
which $cmd >/dev/null || cmd=ffmpeg
2013-03-06 16:40:48 +00:00
framerate=24
quality=8
2013-03-06 11:29:30 +00:00
\rm -f animandel.mpeg && \
$cmd -f image2 -i "$dir/m-%04d.png" -r $framerate -qscale $quality -s ${imgwidth}x${imgheight} animandel.mp4
2013-03-06 11:29:30 +00:00
# convert -delay 10 -loop 0 $liste animandel.gif