AnimMethod
AnimMethod AnimIndex, Method
 
Parameters:

    AnimIndex = The Index of the animation to set
    Method = The Animation method costant
Returns: NONE
 

     The AnimMethod commands allows us to select the type of animation is using. Animations can move forward,backward and even poing pong.




Animation Method Constants



AnimMethod_Idle ; Animation doesn't move

AnimMethod_Forward ; Moving forward through the frame sheet

AnimMethod_BackWard ; Moving backward through the frame sheet

AnimMethod_ForwardOnce ; Moving foward through the frame sheet once. Anim stops when it reaches the end

AnimMethod_BackWardOnce ; Moving backward through the frame sheet. Anim stops when it reaches the start.

AnimMethod_PingPongForward ; Ping pong through frame sheet starting forward , then moving backwards.

AnimMethod_PingPongBackWard ; Ping pong through frame sheet starting bardward , then moving forwardss.






FACTS:


      * None



 
Example Source: Download This Example
; include the frame sheet animation library
  #Include "FrameSheetAnims"
  
; The file name of the example frame sheet we're going
; to load
  Filename$=ProgramDir$()+"Help/Commands/Media/Animations/explosions.png"
  
; Load the Frame sheet
  FrameSheet=LoadFrameSheet(Filename$,64,64,RGB(0,0,0))
  
  
; Create some animations using the various anim methods
  Dim Anim(6)
  Anim(0= MakeMyAnim(frameSheet,1,AnimMethod_Idle)
  Anim(1= MakeMyAnim(frameSheet,1,AnimMethod_Forward)
  Anim(2= MakeMyAnim(frameSheet,1,AnimMethod_BackWard)
  Anim(3= MakeMyAnim(frameSheet,1,AnimMethod_ForwardOnce)
  Anim(4= MakeMyAnim(frameSheet,1,AnimMethod_BackWardOnce)
  Anim(5= MakeMyAnim(frameSheet,1,AnimMethod_PingPongForward)
  Anim(6= MakeMyAnim(frameSheet,1,AnimMethod_PingPongBackward)
  
  
; Limit the programs speed to 5 fps (or there abouts)
  SetFPS 5
  
  
; Run This section of code, until a key is pressed
  Repeat
     
   ; Clear The Screen
     Cls RGB(0,0,0)
     
     
     
     For lp=0 To 6
        
        x#=100
        y#=50+(lp*50)
        
      ; Draw the current state of this animation.
        DrawAnim( Anim(lp),x#,y#,true)
        
     Next
     
     
     
   ; show the screen to the user and wait for a key press
     Sync
     
   ; If no key is pressed, jump back to the repeat
   ; run this section of code again.
  Until ScanCode()<>0
  
  
Psub MakeMyAnim(FrameSheet,FrameRate,Method)
  Anim =NewAnim(FrameSheet)
  AnimFrameRate Anim,Framerate
  AnimMethod Anim, Method
EndPsub Anim
  
 
Related Info: GetAnimMethod :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com