When I follow this instructions:
http://www.geogebratube.org/forum/viewtopic.php?f=20&t=25986 the resulting picture differs from the original in that way, that there is no stagnation in the movement at the end of one loop. The required stagnation is probably made by repeating one frame within some period. However when one decomposes the original gif according the instructions into frames, then there is no repeated frame (which causes the unwanted smooth motion in the end). What I am looking for is some way how to adjust autoplaying that will go from the first frame 0 to the last (let's say 22nd) and then, before it skips to the beginning again, it will repeat the last (the 22nd) frame for some while. Thank you for you advice.

1 Answer
1

The easiest thing is to use the animateinline environment and then "manually" include the images, and lastly make the last image have a slow frame rate.

However, I would like to show you a couple of possibilities with the animate package.

Throughout this the distinction between image and frame is not enforced. Please ask if in doubt.

Animation problems

Often including an animation in a file creates huge pdf's which is often not desirable.

One way to circumvent this is to re-use the images whenever they have something in common. Thus for plots, some of the stuff in an animation that will be constant are:

Axis lines

Tick descriptions

Legends

Titles

Common data points

etc.

All these are stored in each frame unless one carefully reuses them. As already hinted, this can greatly reduce the pdf file size (especially if a lot of the frames can be re-used, or combination thereof).

The feature known as timelines for the animate package can handle these things.
The timeline has the capability of reusing several images without taking more space.

In the below examples I will demonstrate this.

animateinline

The animateinline environment is the manual way of including images, instead of using \animategraphics. It also provides with some nice features to control the animation:

\newframe parses the current frame and goes to the next frame

\newframe* parses the current frame and goes to the next frame, however, an instantaneous pause is inserted in the frame.

\newframe[<frame rate>] parses the current frame and goes to the next frame, however, the frame rate for the remaining animation is set to <frame rate> (notice that it is reset when it loops)

If you did not include the last picture three times you would also experience a hang in between the 4th and 5th frame. Thus you need to include it three times. Try and experiment and see for yourself.

Timelines, the greatness of animations

This is probably where animate has a great advantage of use compared to out of the box animation creations. As already mentioned you are allowed to handle transparencies and combine however you wish each frame.

The basic idea is a timeline file which holds information about when and how each frame is utilized.

Each line is made out of three columns, separated by a :. The three columns holds the following information:

Supply an asterisk (*) or nothing (* for pause)

Supply an integer (f) or nothing (f for frame rate)

Supply a frame formatting string

Each format is comma (,) separated (the left-most format is the bottom one in the current frame)

A simple integer format (i) tells animate to use frame i, frames start from count 0 (i is the same as ix1)

A format as ixn, where i and n are integers (x is actually x). i tells which frame to use and n tells for how many frames it is going to stay on the animation. Thus: 2x2 will tell the animation to insert frame 2 and stay for a total of 2 frames. If n=0 it will be there for the remaining part of the animation.

A c which clears the transparency stack. This is useful for removing any ix0 frames inserted.

Size decrease

Lets compare the images created in the previous section (on my pc that is):

fig<0-4>.pdf are 18kb (all information)

background.pdf is 17kb (only axis descriptions and axis lines)

fig_no_axis<0-4>.pdf are 1.4kb (only data points)

Ok, so already here you can infer what I mean about size reduction. It should be noted that these images does not contain many data points. Thus the size decrease is larger than would be expected for large data sets, however, if the number of frames are very large, it could have an impact on large data sets as well. Also creating animations from pdf's generally can utilize similar stuff (so the size change for pdf images are minimal).

Notice to have transparency on images

When using transparency on pictures (that is 0x0,1,2) it is necessary that the images contain an alpha-channel, that is: transparency. I would recommend using png images.

Notice that now it is one more image long, with a changed frame rate for the last image. Through this, you can fine tune the frame rate, pauses etc. in the animation.

Notice that it could have been made shorter by having background.pdf=fig_no_axes0.pdf and fig_no_axes<0-4>.pdf=fig_no_axes<1-5>.pdf and then used \animategraphics[timeline=<name>.tml]{5}{fig_no_axes}{0}{5}.

Thank you for this great tutorial on the timeline feature of animate!
–
AlexGSep 19 '12 at 7:16

1

@AlexG you are welcome, the timeline feature is highly underrated!
–
zerothSep 19 '12 at 7:25

I always wonder whether the timeline option description in the doc is clear enough or too long to be read.
–
AlexGSep 19 '12 at 8:08

@AlexG I like your (I am guessing you are Alexander Grahn?) explanation with the tables, the examples are great. I think that they best describe their use. With such a complicated feature, examples speak a lot more than words! To my taste I would probably cut down text and add short examples which built up to a complete transparency show. The text can be difficult to grasp at points, albeit I have no idea how to make it clearer (do not take offence of this!).
–
zerothSep 19 '12 at 8:16

1

Thanks a lot for your comments! Unfortunately, inventing examples is quite time consuming. It would be nice if users contribute examples to the texample.net site.
–
AlexGSep 19 '12 at 9:30