From 264ce6eee2e0071d14d417cc83466762bbded1d8 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 7 Aug 2001 16:38:06 +0000
Subject: [PATCH] A general animation script

---
 demos/anim.script | 73 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 demos/anim.script

diff --git a/demos/anim.script b/demos/anim.script
new file mode 100644
index 0000000000..41f274f28a
--- /dev/null
+++ b/demos/anim.script
@@ -0,0 +1,73 @@
+//
+// This is a generic 320x240 mpg + animated gif creation script
+// 
+// Requirements: mpeg_encode, whirlgif and a UNIX shell
+//
+// Usage: gmsh file(s) animate.script
+//
+// Output: view.mpg and view.gif
+//
+
+General.GraphicsWidth = 320 ; 
+General.GraphicsHeight = 240 ;
+PostProcessing.Link = 1;
+
+For i In {1:View[0].NbTimeStep}
+
+  View[0].TimeStep++;
+  Draw;
+  If (i < 10)
+    Print Sprintf("out-0%g.jpg", i);
+    Print Sprintf("out-0%g.gif", i);
+  EndIf
+  If (i >= 10)
+    Print Sprintf("out-%g.jpg", i);
+    Print Sprintf("out-%g.gif", i);
+  EndIf
+
+EndFor
+
+// create the parameter file for mpeg_encode
+
+System 'echo "PATTERN          I"             > out.par' ;
+System 'echo "BASE_FILE_FORMAT JPEG"         >> out.par' ;
+System 'echo "GOP_SIZE         30"           >> out.par' ;
+System 'echo "SLICES_PER_FRAME 1"            >> out.par' ;
+System 'echo "PIXEL            HALF"         >> out.par' ;
+System 'echo "RANGE            10"           >> out.par' ;
+System 'echo "PSEARCH_ALG      TWOLEVEL"     >> out.par' ;
+System 'echo "BSEARCH_ALG      CROSS2"       >> out.par' ;
+System 'echo "IQSCALE          8"            >> out.par' ;
+System 'echo "PQSCALE          10"           >> out.par' ;
+System 'echo "BQSCALE          25"           >> out.par' ;
+System 'echo "REFERENCE_FRAME  ORIGINAL"     >> out.par' ;
+System 'echo "OUTPUT           out.mpg"      >> out.par' ;
+System 'echo "INPUT_CONVERT   *"             >> out.par' ;
+System 'echo "INPUT_DIR       ."             >> out.par' ;
+System 'echo "INPUT"                         >> out.par' ;
+If (View[0].NbTimeStep < 10)
+  System Sprintf('echo "out-*.jpg [01-0%g]" >> out.par', View[0].NbTimeStep) ;
+EndIf
+If (View[0].NbTimeStep >= 10)
+  System Sprintf('echo "out-*.jpg [01-%g]"  >> out.par', View[0].NbTimeStep) ;
+EndIf
+System 'echo "END_INPUT"                    >> out.par' ;
+
+// Call mpeg_encode
+
+System "mpeg_encode out.par" ;
+
+// Call whirlgif
+
+System "whirlgif -loop -o out.gif out-*.gif" ;
+
+// Clean-up all temp files
+
+System "rm -f out-*.gif" ;
+System "rm -f out-*.jpg" ;
+System "rm -f out.par" ;
+
+// Rename the output files to the view name
+
+System StrCat( StrCat("mv out.gif ", Sprintf(View[0].Name)), ".gif");
+System StrCat( StrCat("mv out.mpg ", Sprintf(View[0].Name)), ".mpg");
-- 
GitLab