I created the GIF animation with the plot of a sinusoidal wave moving towards the LHS of the image, suggested here.

gif = Table[Plot[Sin[a + x], {x, 0, 10}], {a, 0, 10, 0.1}];
Export["sinSmooth.gif", gif]

After showing all the correct motion, the GIF stops. Most of the GIFs created in this site don't, instead.

In the same link it is suggested how to let the animation go backwards after reaching the end:

gif = Table[Plot[Sin[a + x], {x, 0, 10}], {a, 0, 10, 0.1}];
Export["sinSmoother.gif",Flatten[{gif, Table[gif[[i]], {i, Length[gif] - 1, 2, -1}]}]]

But anyway, after completing one or two cycles (depending on the image viewer used), even this way it stops.

What about creating a continuous loop?

Is there an option (in the Plot, Block or Export function) which can make the GIF continuously being reproduced, regardless of the image viewer?

  • $\begingroup$ please paste your code or show a minimal example ! $\endgroup$
    – Ali Hashmi
    May 8, 2017 at 16:05
  • 1
    $\begingroup$ @AliHashmi I just made as you suggested. $\endgroup$
    – BowPark
    May 8, 2017 at 16:11

1 Answer 1


As partly mentioned in this: Add delay to the final frame of a GIF? we can use "AnimationRepetitions" -> ∞ to loop a GIF indefinitely:

Export["C:\\Users\\Ali Hashmi\\Desktop\\test.gif", gif, "AnimationRepetitions" -> ∞] 
  • 1
    $\begingroup$ I can't make it to work on 12.1. Any idea why? $\endgroup$
    – sam wolfe
    Jun 27, 2020 at 18:39
  • 1
    $\begingroup$ @samwolfe AnimationRepetitions -> Infinity spits out an error but works anyway. $\endgroup$ Sep 21, 2020 at 19:09
  • $\begingroup$ Note that the quotes are very important, without them the option won't have any effect! $\endgroup$
    – Ruslan
    Apr 13, 2021 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.