18

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?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
BowPark
  • 315
  • 2
  • 7

1 Answers1

28

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" -> ∞] 
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Ali Hashmi
  • 8,950
  • 4
  • 22
  • 42