Select Git revision
GmshSocket.h
Forked from
gmsh / gmsh
Source project has a limited visibility.
anim-all.script 2.08 KiB
//
// Animate all views (together) and save the animation as a 320x240
// mpeg and a 320x240 animated gif
//
// Requirements: mpeg_encode, whirlgif and a UNIX shell
//
// Output: anim.mpg and anim.gif
//
General.GraphicsWidth = 320 ;
General.GraphicsHeight = 240 ;
Print.JpegQuality = 100;
For i In {1:View[0].NbTimeStep}
Draw;
Print Sprintf("anim-%03g.jpg", i);
Print Sprintf("anim-%03g.gif", i);
For j In {1:PostProcessing.NbViews}
View[j-1].TimeStep++;
EndFor
EndFor
// create the parameter file for mpeg_encode
System 'echo "PATTERN I" > anim.par' ;
System 'echo "BASE_FILE_FORMAT JPEG" >> anim.par' ;
System 'echo "GOP_SIZE 30" >> anim.par' ;
System 'echo "SLICES_PER_FRAME 1" >> anim.par' ;
System 'echo "PIXEL HALF" >> anim.par' ;
System 'echo "RANGE 10" >> anim.par' ;
System 'echo "PSEARCH_ALG TWOLEVEL" >> anim.par' ;
System 'echo "BSEARCH_ALG CROSS2" >> anim.par' ;
System 'echo "IQSCALE 1" >> anim.par' ;
System 'echo "PQSCALE 10" >> anim.par' ;
System 'echo "BQSCALE 25" >> anim.par' ;
System 'echo "REFERENCE_FRAME DECODED" >> anim.par' ;
System 'echo "OUTPUT anim.mpg" >> anim.par' ;
System 'echo "INPUT_CONVERT *" >> anim.par' ;
System 'echo "INPUT_DIR ." >> anim.par' ;
System 'echo "INPUT" >> anim.par' ;
System Sprintf('echo "anim-*.jpg [001-%03g]" >> anim.par', View[0].NbTimeStep) ;
System 'echo "END_INPUT" >> anim.par' ;
// Call mpeg_encode
System "mpeg_encode anim.par" ;
// Call whirlgif
System "whirlgif -minimize -loop -o anim.gif anim-*.gif" ;
// Clean-up all temp files
System "rm -f anim-*.gif" ;
System "rm -f anim-*.jpg" ;
System "rm -f anim.par" ;
// One could also rename the output files with the view name
// System StrCat( StrCat("mv anim.gif ", Sprintf(View[0].Name)), ".gif");
// System StrCat( StrCat("mv anim.mpg ", Sprintf(View[0].Name)), ".mpg");