home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / animation / animation1-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  2.1 KB  |  77 lines

  1. rem Animation Showcase
  2.  
  3. rem Standard Setup Code for all examples
  4. sync on : sync rate 0 : color backdrop rgb(0,128,0)
  5. set text font "arial" : set text size 20
  6. set text to bold : set text transparent
  7.  
  8. rem Produce Title
  9. ink rgb(0,0,0),0 : center text (screen width()/2)+1,7,"Full Animation Support"
  10. ink rgb(255,255,255),0 : center text screen width()/2,6,"Full Animation Support"
  11.  
  12. rem Load Animation and Set Up
  13. load animation "avi\demo1.avi",1
  14.  
  15. rem Set Animation to Loop
  16. play animation to image 1,1,0,0,animation width(1),animation height(1)
  17. loop animation 1
  18.  
  19. rem Create models for 3D animation effect
  20. make object box 1,350,350,1000
  21. scale object 1,100,100,-100
  22. set object 1,1,0,0,0,0,0,0
  23. texture object 1,1
  24. make object sphere 2,50
  25. texture object 2,1
  26. set sphere mapping on 2,1
  27. for t=0 to 7
  28.  make object cube 3+t,25
  29.  texture object 3+t,1
  30. next t
  31.  
  32. rem Main loop
  33. do
  34.  
  35. rem 3D effects
  36. a#=wrapvalue(a#-4)
  37. scale object 2,100+cos(a#)*25,100+sin(a#)*25,100
  38. for t=0 to 7
  39.  position object 3+t,cos(wrapvalue(a#+(t*45)))*40,sin(wrapvalue(a#+(t*45)))*30,sin(wrapvalue(a#+(t*45)))*40
  40.  if t=0 or t=3 or t=6 then xrotate object 3+t,wrapvalue(object angle x(3+t)+2)
  41.  if t=1 or t=4 or t=7 then yrotate object 3+t,wrapvalue(object angle y(3+t)+2)
  42.  if t=2 or t=5 then zrotate object 3+t,wrapvalue(object angle z(3+t)+2)
  43. next t
  44. position camera cos(a#)*10,sin(a#)*10,-100
  45. point camera 0,0,0
  46.  
  47. rem Show Buttons
  48. over=0
  49. for but=1 to 3
  50.  for high=0 to 1
  51.   if high=0 then ink rgb(20,20,20),0 : bx=1 : by=1
  52.   if high=1 then ink rgb(200,200,255),0 : bx=0 : by=0
  53.   if high=1 and mousey()>420 and mousey()<460
  54.    if but=1 and abs(mousex()-170)<50 then ink rgb(255,255,255),0 : over=1
  55.    if but=2 and abs(mousex()-320)<50 then ink rgb(255,255,255),0 : over=2
  56.    if but=3 and abs(mousex()-470)<50 then ink rgb(255,255,255),0 : over=3
  57.   endif
  58.   if but=1 then but$="STOP"
  59.   if but=2 then but$="PLAY"
  60.   if but=3 then but$="EXIT"
  61.   center text 320+bx+((but-2)*150),420+by,but$
  62.  next high
  63. next but
  64.  
  65. rem Controls
  66. if mouseclick()=1
  67.  if over=1 then pause animation 1
  68.  if over=2 then resume animation 1
  69.  if over=3 then end
  70. endif
  71.  
  72. rem Update screen
  73. sync
  74.  
  75. rem End loop
  76. loop
  77.