Skip to content

Animated GIF files from AnyBody

Morten Enemark Lund edited this page Apr 11, 2017 · 3 revisions

How to create animated GIF files from AnyBody

Before creating a animated GIF file you need to create a video from your model. Check the video AnyScript video class template for how to create videos from your AnyBody simulations.

Video in them self are nice, but sometimes they are not enough. If we want something that loops continuously and runs automatically, then we need animated GIF files. The video class template can also generate gif files, once you have a video.

Just run the operation Operations.Convert_video_to_animated_gif

Convert GIF operation

The video plugin does not create animated GIF by default. For several reasons. Not all videos work well as an animated GIF file, and GIF files can take up a lot of space. But if you want to avoid the manual step, when generating the GIF file add the CREATE_GIF=1 argument to the AnyScript class template:

  VideoLookAtCamera  MyCam (UP_DIRECTION = y, CREATE_GIF = 1) = 
  {
       CameraLookAtPoint = Main.MyModel.Femur.Knee.r;  
       CameraFieldOfView  = 1;
       CameraDirection  = {1, 1, -1};
       BackgroundColor = {1, 1, 1};
       VideoInputFrameRate  = 10;
       VideoResolution = {1920, 1080};
       Analysis = {
          AnyOperation &ref = Main.MyStudy.Kinematics;
       };
  };

Human gif file

Find the code on GitHub

The AnyScript template is hosted on GitHub, where you can examples and documentation on how the class_template works.

Also read these two posts on AnyScript.org:

Clone this wiki locally