animlib
An anim is a Blitz object, numbered from 0, that holds an IFF ANIM
file of the kind Deluxe Paint writes: a first picture and, for every
further frame, the changes from the frame two before (the compression
called ANIM 5). Such an animation is meant for double buffering, two
bitmaps shown in turn. LoadAnim loads it, in Amiga mode; ILBMInfo
tells the size and mode of the screen it needs. InitAnim draws the
first picture into the bitmaps, and every NextFrame draws the next
frame into the used bitmap:
LoadAnim 0,"walk.anim",0
BitMap 0,320,200,5 : BitMap 1,320,200,5
Use BitMap 0
InitAnim 0,1
; then, per frame, alternating the bitmaps:
; Use BitMap db : NextFrame 0 : show bitmap dbAfter the last frame, NextFrame goes on from the start. The whole
animation has one palette.
A file that cannot be opened is the error “Can’t Open Anim File”, and a file with another kind of compression “Anim format not supported”. The first picture may be packed, as Deluxe Paint writes it, or stored unpacked.
Based on the animlib guide by Acid Software.
Library number 94. It manages Anim objects, by default at most 10 (the compiler options set the maximum).
Commands
Anim
The object of an IFF animation, as the introduction describes.
Object name. Help text: - IFF Anim
Frames
The number of frames of the anim.
Function, result .w. Help text: (Anim#)
Arguments: .w
InitAnim
Draws the first picture of the anim into the used bitmap and, with BitMap#, also into that bitmap, and starts the animation from its beginning.
Statement. Help text: Anim#[,BitMap#]
2 forms:
.w.w, .w
Use the form with two bitmaps for double buffering. With runtime error checking, a bitmap smaller than the anim is the error “BitMap not large enough for ANIM”.
LoadAnim
Loads an IFF ANIM file into an anim object, and its colours into Palette# if it is given. An anim the object held before is freed. Amiga mode only.
Statement. Help text: Anim#,Filename$[,Palette#]
2 forms:
.w, $.w, $, .w
A file without a first picture (BODY), or one whose picture has a
width, height or depth of 0, is loaded without picture data:
InitAnim and NextFrame then draw nothing.
NextFrame
Draws the next frame of the anim into the used bitmap; after the last frame, it goes on from the start.
Statement. Help text: Anim#
Arguments: .w
With runtime error checking, an anim not set up with InitAnim is the
error “Anim not Initialized”, and one of a single frame “Anim has only
1 frame”. Without runtime error checking, an anim with a single
change, or none, plays once and then stays on its last frame.