How to Start and Stop a .gif
While a .gif can’t be paused, there are ways to control when it plays and when it stops.
When the control containing the gif is rendered for the first time it will start running the frames of the image. In the current implementation, animations specified as an animated GIF will loop forever.
To stop the animation, you can simply change the image render extension’s image reference to a non-gif image or simply mark the control as hidden.
To expand on that last point, every Control has a parameter called gre.hidden. This is what you can toggle to hide and unhide the control which will stop the gif from playing.
Otherwise changing the Control's Image reference to be something other than the gif and then changing it back will trigger the gif playback. In this way you can control it.
To make it a little more of a refined experience, the non-gif image used could be the first frame of the .gif. This way when you do switch the reference to the .gif it will look like it was paused and playback has just begun.
A demo demonstrating these simple approaches can be downloaded at the following link:
Comments
Please sign in to leave a comment.