Gif animated Extension. Clickable. Transparent Background

Hello Friend,

a couple of years ago I published an extension to work with animated Gif,
https://groups.google.com/forum/#!category-topic/mitappinventortest/app-inventor-extensions/_qwTrvHKlXo

now I publish another improved code.

  • It needs a Clock and an Image component.
  • The image can be clickable and transparent background.

Blocks:

  • LoadGif, needs a Image component. Image file can be in asset, it is only necessary to write its file name.
    [It could also be in the SdCard, in this case we would write the absolute address /mnt/sdcard/directorio/file.gif]
    We can set a color mask for the transparent background, ¡try several!, white, black, yellow …

  • GetFrameCount, number of frames gif file.

  • GetCurrentFrameIndex, number of actual frame showed.

  • GetNextDelay, delay of next frame, gets of file gif.

  • Clock1.Timer
    Image1.Photo = NextFrame (gets frame, inserts in Image)

  • CopyFrames, decoder each frame and save them in the indicated directory. If the directory does not exist, create it automatically. The directory base is /mnt/sdcard/. It could be saved in subdirectories. Example: images/sports.

  • Events.
    ImageDown and ImageUp, x,y positions of touch in image. inside is a boolean.

oooooooooooooooooooooooooooooOOOooooooooooooooooooooooooo

  • You can create the animated gif in two ways:
    a) Using LoadGif and NextImage (each image is decoded and displayed.)
    b) Using CopyFrames, (all images are decoded and displayed one by one.)

  • Let’s see several examples:

1.- Each image is decoded and presented.

2.- All images are decoded, copied in directory mis_imagenes and displayed one by one. CopyFrames.

3.- If the transparent background doesn’t work for us, we can put a flat colored background.

oooooooooooooooooooooooooooooOOOooooooooooooooooooooooooo

  • This extension is based in GifDecoder.java but with many changes.

  • You can get com.KIO4_AniGif.aix file from:

http://kio4.com/appinventor/293A_extension_gif_animado_click.htm

More extensions:
http://kio4.com/appinventor/index.htm#extensiones

- Feliz Año Nuevo.
- Happy New Year.

Juan Antonio Villalpando.

4 Likes

I opened this (Companion) on a Galaxy Note 3 (Android 5) & a Galaxy Note 8 (Android 9) and get this:


grafik
It’s already late … just a short feedback, I haven’t tested anything else …

Greetings, Anke

Thank you Anke, now fixed.

@Juan_Antonio

Are able to develop your extension to “make a gif”, to combine a set of images to one gif file ?
Don’t know if there is a GifEncoder.java ?

This is interesting, I will try.

Hi @Juan_Antonio i’m new i was wondering if you could download app inventor on apple?

Apple? iOS? read this categorie, please:
https://community.appinventor.mit.edu/c/appinventor-ios/19

Please do not hijack threads! You already started a thread about this here:

FOR TRANSPARENT BACKGROUND

try to use this color as number: 4294967295

note: use this as number (the blue box) not as text (the red one)

4294967295 is white.