Elegant system for doing sprite animations?

BlitzMax Forums/BlitzMax Programming/Elegant system for doing sprite animations?

Hope this works, wrote it off the top of my head.

type TAnimation
Field Image:TImage, X:Int, Y:Int
Field Frames:Int[] = [0,1,2,2,1,0]
Field CurrFrame:int
Field AnimTimer:Int = Millisecs()
Field AnimSpeed:Int = 250

method Update()
if Millisecs() - AnimTimer > AnimSpeed then AnimTimer = Millisecs() ; CurrFrame:+1
If CurrFrame > Frames.Length - 1 then CurrFrame = 0
end method

method Render()
DrawImage Image,X,Y,Frames[CurrFrame]
end method
end type