(This topic was edited on 2022/06/21)
Hello friends,
this extension is about inserting animated gifs in our applications.
- It needs 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) -
GetFrames, decoder each frame and save them in ASD/frames_gif.
-
Events.
ImageDown and ImageUp, x,y positions of touch in image. inside is a boolean.
Frames, get frame. Insert in Image.Photo = frame
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.
- Four gif images.
p193A_gif_animado_v2.aia (866.8 KB)
- Touch Image1
2.- All images are decoded, copied in directory ASD/frames_gif and displayed one by one. CopyFrames.
p193A2_gif_animado_v2i.aia (1.1 MB)
3.- If the transparent background doesn't work for us, we can put a flat colored background.
- Look make color (0,0,0,0)
p193A3_gif_animado_v2.aia (1.8 MB)
oooooooooooooooooooooooooooooOOOooooooooooooooooooooooooo
-
This extension is based in GifDecoder.java but with many changes.
-
You can get com.KIO4_AniGif.aix file from:
More extensions:
http://kio4.com/appinventor/index.htm#extensiones
Juan Antonio Villalpando.