anim.bb 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Global info1$="Animation demo"
  2. Global info2$="Hold down <return> to run"
  3. Global info3$="Hit <space> to toggle transitions"
  4. Include "../start.bb"
  5. mesh_3ds=LoadAnimMesh( "makbot\mak_robotic.3ds" ) ;anim seq 0
  6. LoadAnimSeq mesh_3ds,"makbot\mak_running.3ds" ;anim seq 1
  7. PositionEntity mesh_3ds,-15,-15,0
  8. mesh_x=LoadAnimMesh( "makbot\mak_robotic.x" ) ;anim seq 0
  9. LoadAnimSeq mesh_x,"makbot\mak_running.x" ;anim seq 1
  10. PositionEntity mesh_x,+15,-15,0
  11. pivot=CreatePivot()
  12. cam=CreateCamera( pivot )
  13. PositionEntity cam,0,0,-100
  14. lit=CreateLight()
  15. RotateEntity lit,45,45,0
  16. Animate mesh_3ds,2 ;start ping-pong anims...
  17. Animate mesh_x, 2
  18. trans=10
  19. While Not KeyHit(1)
  20. If KeyHit(57)
  21. trans=10-trans
  22. EndIf
  23. If KeyDown(28)
  24. If AnimSeq(mesh_3ds)=0 Animate mesh_3ds,1,.5,1,trans
  25. If AnimSeq(mesh_x )=0 Animate mesh_x, 1,.5,1,trans
  26. Else
  27. If AnimSeq(mesh_3ds)=1 Animate mesh_3ds,2,1,0,trans
  28. If AnimSeq(mesh_x )=1 Animate mesh_x ,2,1,0,trans
  29. EndIf
  30. If KeyDown(30) MoveEntity cam,0,0,10
  31. If KeyDown(44) MoveEntity cam,0,0,-10
  32. If KeyDown(203) TurnEntity pivot,0,3,0
  33. If KeyDown(205) TurnEntity pivot,0,-3,0
  34. UpdateWorld
  35. RenderWorld
  36. Text 0,FontHeight()*0,"Anim seq: "+AnimSeq( mesh_3ds )
  37. Text 0,FontHeight()*1,"Anim len: "+AnimLength( mesh_3ds )
  38. Text 0,FontHeight()*2,"Anim time:"+AnimTime( mesh_3ds )
  39. Text 0,FontHeight()*4,"Anim seq: "+AnimSeq( mesh_x )
  40. Text 0,FontHeight()*5,"Anim len: "+AnimLength( mesh_x )
  41. Text 0,FontHeight()*6,"Anim time:"+AnimTime( mesh_x )
  42. Text 0,FontHeight()*8,"Transition time="+trans
  43. Flip
  44. Wend
  45. End