X_DRAWANIM num#, from#, to#, interpol#, full_anim#
X_DRAWANIM calculates which animation frame to draw and draws it from within an animation sequence.
num# specifies the animated object.
The frames from# and to# specify start and end frames of the animation to interpolate between. The first frame has the index '0'.
interpol# specifies a value from 0 to 1.0 indicating how far between frame from# and to# to go to find the frame to draw.
full_anim# should be set to TRUE if you wish to interpolate over a range of animation frames, or FALSE to include only the start and end frame.
Setting from# = 3 and end#=6 tells X_DRAWANIM that you want to draw one of the frames between frames 3 and 6 (inclusive).
If you set full_anim# to FALSE, either frame 3 or frame 6 will be drawn depending on the value of interpol#. Any interpol# value < 0.5 will draw frame 3, any value > 0.5 will draw frame 6.
If you set full_anim# to TRUE, any one of the frames 3,4,5,6 may be drawn. If interpol# was set to 0.333, you would be asking it to draw the frame a third of the way between frames 3 and 6 - this would be frame 4.
// Animation Demo
ddd_file$ = "moon" // "trooper"
scale = 7
X_LOADOBJ ddd_file$+".ddd", 1
LOADSPRITE ddd_file$+".bmp", 1
// DRAWRECT 0,0,640,480,RGB(80,80,255)
X_CAMERA 0, 20, 900, 0, 0, 0
X_AMBIENT_LT 0, RGB(128,128,128)
IF permil>=1 THEN permil=0
X_SCALING scale, scale, scale
X_ROTATION 270, 1,0,0
X_ROTATION phi, 0.5,1,0
X_DRAWANIM 1, 0, 128, permil, TRUE
// X_DRAWOBJ 1, 0 // ID of Object, Number of Keyframe to Render
PRINT "PRINT/DRAWSPRITE ? MAKE2D !", 10, 20