How to animate a .PNG file?

BlitzPlus Forums/BlitzPlus Programming/How to animate a .PNG file?

DNielsen(Posted 2004) [#1]
@all,
I have a big .PNG file with frames of an animation. Each frame is 180 x 262 pixels, and the animation has 80 frames. In BlitzPlus, what is the most efficient method of showing this animation? By using LoadImage() to load the file, and DisplayImage(framenumber) to display it frame by frame? or are there better commands than DisplayImage()? Any ideas welcomed


soja(Posted 2004) [#2]
If you use LoadImage, there will only be 1 frame -- the whole image.

Use LoadAnimImage. Make sure your image frames are all horizontally aligned. In other words, the dimensions of your image should be 14400 x 262.

img=LoadAnimImage(filename, 180, 262, 0, 80)
then
DrawImage(img, x, y, frame)


DNielsen(Posted 2004) [#3]
@Soja
It's odd. My filesize is 13370 x 262 ??? (1.54Mb). But there must be a problem SOMEWHERE since my DrawImage() shows garbage ...


Hotcakes(Posted 2004) [#4]
Olsen, if your images are supposed to be 180 pixels wide and there are supposed to be 80 of them, then the image can be no other width than 14400 pixels. Looks like you have some editing to do =]

13370/180 = 74.28 frames =]
13370/80 = 167.125 width for each frame.

So something is wrong somewhere in the image widths =]


DNielsen(Posted 2004) [#5]
@iumop ap!sdn w,I 'aw d|aH
You are CORRECT! There is SOMETHING wrong with my picture file ... THANKS!!