Use GIF in kodular app (without extension)

I was searching how to use animated GIFs in my app this morning.

OBSERVATIONS
It seems that “Picture” component doesn’t handle GIFs (even if they display correctly in creator.kodular.io)
It seems that support for GIFs has been added a few years ago then removed.

There are numerous discussions about how to handle GIFs in kodular. (one complex solution : [Free] GifView extension Free for all : NEW Update 17/11/17 😋 😋 😋 😋 - ClassicExtensions - Community)
Most working solutions propose to use multiple images + clock to emulate a kind of GIF (Gif animated Extension. Clickable. Transparent Background - Extensions - MIT App Inventor Community).

One solution worked for me (Extension: Animated Gif Clickable. Transparent bg - #13 by Juan_Antonio - ClassicExtensions - Community, very last version) but I don’t know if it is working on every phone. Plus, it requires an extension.

OTHER SOLUTION (not better than last one)
My solution is inspired from App Inventor Code Snippets | Pura Vida Apps solution.
He proposes to use a WebViewer, that can display animated GIFs.
But we should find the place where the GIF is stored in the app assets, a bit complex.

I find that you could use a GIF to base64 (Base64 - Wikipedia) converter like this one :
GIF to Base64 | Image | Base64 Encode | Base64 Converter | Base64
(output format : HTML image)

In designer, use a WebViewer.
In code, use :
blocks (2)

GIF should display.

Hope this can help.

A. R.

Note : major problem : user can move GIF inside the webviewer (except if you use CardView with “full clickable” ON :wink:
You should disable zoom display/zoom on etc.

8 Likes

Good guide!

I even used a similar approach using Base64, plus it avoids uploading the file to Assets

1 Like

You can also show gif by converting it into json and using lottie animation component.

Edit: doesn’t work.

2 Likes

Your solution looks awesome.
I tried to convert my GIF with Convert GIF to JSON / GIF to JSON converter online & free — pdfmall.com then to use the JSON file as source for Lottie component, but I get error and app crashes.
What am I doing wrong ?

I think problem is with gif or converted json file.

Try converting using GIF to JSON - OnlineConvert.com

Edit: doesn’t work.

2 Likes

Note : the extension I linked in my main message (Extension: Animated Gif Clickable. Transparent bg - #ThunkableClassicExtensions - Community) seems to have a major flaw : changing the height/width of the layout does not change height/width of the GIF, but it crops it !

If you want to resize the GIF, this is not the solution to go for

Not working either with this converter.
Problem may come from the GIF I’m using
Any idea why it fails ?

Optimization of the GIF maybe ?

I dont have any idea.

not working with the 3 (random, found on the internet) GIFs I tried.
May you provide the GIF that worked for you, so I can compare ?

I was tried json file taken from lottie files.

:+1:


buttons support gif(s)

how please provide some information

Just set your gif as button image

i tried its not working plz provide aia how it works…
i set button background image to gif in designer property… but it only show as image not GIF

try to set image of button from Designer property under property name “Image”


not workingblocks (4) also not work

this also not working

working in only kodular site designer mobile not in companion and app…

if you are giving suggestion only by designer mobile then want to say that its not work in companion and app

1 Like

Why not you use lottie animation component. It is very simple and easy.

You can also set it as clickable and trigger an event when clicked. It can work as button also.

Most important thing is that there are thousands of lottie files available, you can choose any as per your requirement.

no i have own gif and want to use that …
in lottie component will gif works ?

I think no.

Yup, u r right, it worked in Designer only, I never considered trying in apk, my bad!

1 Like