12
$\begingroup$

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?

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

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" -> ∞] 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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