Friday, 8 July 2011

Animating TEX

Short post today but I wanted to set out my work-flow used when generating animated tikz diagrams.

1) Start with your tikz diagram. Instead of fixed values, define variables to be used in their place:


2) Run the sed (aaargh) command on that master file using some kind of loop which changes the value {x} each time through and then spits out the results into numerical .tex files.

2.5) rename all the .tex files to make sure they have the appropriate amount of trailing zeros.

3) Run PDF Latex on each individual .tex file to get a pdf.

4) Convert the PDF to jpg using an appropriate DPI and cropping factor - will vary for each master diagram, so generate a test first and id the correct cropping settings. The display [name].jpg command is very useful for this.

4.5) If desired run another loop to copy all the files in such a way as the animation reverses to create a continuous loop.

5) Take all the jpg files and pipe them into ffmpeg to compress to whatever you want, but x264 is useful. Animated gif may be attractive but ffmpeg doesn't like it.

Job done. More details and exact ubuntu commands to come.

No comments:

Post a Comment