The way I would animate a png is very primitive compared to what Ive seen but Ive been doing it for years via DarkBasic Classic...
First define your images:
(I would name them like so: )
image (1).png
image (2).png
image (3).png
image (4).png
image (5).png
image (6).png
Note: If you select all your images (control-A) and rename the first one "image" or whatever you would like, then it automatically names the rest in sequential order in that format.
You can just change "image" for whatever you name it.
gosub ImageHeader
LoadAnimImages( "image", 6, ".png", 10 )
do
Anim(image.imgID.length - 1)
sync()
loop
ImageHeader:
type anim
sprID as integer
ticks as integer
tickspeed as integer
cycles as integer
imgID as integer[0]
endtype
global image as anim
return
function LoadAnimImages( basename$, frames, extension$, animspeed )
for i = 1 to frames
if getfileexists( basename$ + " (" + str(i) + ")"+ extension$ )
image.imgID.insert( loadimage( basename$ + " (" + str(i) + ")"+ extension$ ) )
endif
next i
image.sprID = CreateSprite( image.imgID[0])
image.tickspeed = animspeed
endfunction
function Anim(numframes)
inc image.ticks
if image.ticks > image.tickspeed
image.ticks = 0
inc image.cycles
if image.cycles > numframes
image.ticks = 0
image.cycles = 0
endif
endif
setspriteimage( image.sprID, image.imgID[ image.cycles] )
endfunction
Not sure if it works.. It should but havent checked but this is kind of how I would work it.. They have AddSpriteAnimation() commands that can shorten the process but I haven't messed around with that method as of yet.