Adding Animated Gifs

You can find animated Gifs all over the internet. A great website for finding a large collection of them is giphy.com. Once you find them, you'll need to get them over to your Raspberry Pi. The easiest way would be to just use FTP or downloading them directly from the internet on your Pi if that's what you would prefer. Just make sure they're in the same folder as the script.

The default folder used in the test scripts is an images subfolder inside of the folder the script is in. If you are using something different, be sure to change it at the bottom of the script.

Scrolling and Navigating through Animated Gifs

Just rotate the knob clockwise to start scrolling through the frames of the current Gif. If you turn the knob fast, it will move faster and turning it slowly will make it advance frames at a slower rate.

For the Mini PiTFT Player it seems turning the knob too fast will make the animation slow down a bit because it takes more processing power to pipe the data out to the TFT display and it can't read the rotary encoder quite as often.

To load the next animated Gif, just click the knob inward. When it gets to the end, it will load the first Gif.

Exiting the Player

On the PyGame Player, just hit ESC on the keyboard to exit. For the Mini PiTFT Player, you can just hit Control+C to exit.

Some Modifications to Try

There is some room for modification in the code. For instance in either player, you can change include_delays=False to include_delays=True and then it will include the built-in delays that are part of the animated Gif file.

Another modification that could be made for the PyGame Player takes advantage of the touch sensor on the Rotary Trinkey and uses that to send a quit command to close the application.

For the Mini PiTFT Player you can have it jump a certain number of frames based on the rotary increase on the knob. This may have the effect of the animated gif skipping around though. Have fun with it and see what you can get it to do.

This guide was first published on Sep 28, 2021. It was last updated on 2021-09-28 18:22:58 -0400.

This page (Using the Player) was last updated on Jul 03, 2022.

Text editor powered by tinymce.