| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>AddAnimSeq ( entity,length)</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- entity - entity handle
<br />
- length -
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Creates an animation sequence for an entity. This must be done before any animation keys set by SetAnimKey can be used in an actual animation however this is optional. You may use it to "bake" the frames you have added previously using SetAnimKey.
<br />
-
<br />
- Returns the animation sequence number added.
- </td>
- </tr>
- </table>
- <h1><a href=../3d_examples/AddAnimSeq.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ;Create 3d animation example
<br />
-
<br />
- ;Set up a simple nice looking level
<br />
- Graphics3D 640,480
<br />
- camera=CreateCamera()
<br />
- PositionEntity camera,0,12,-12
<br />
- RotateEntity camera,35,0,0
<br />
- light=CreateLight(2)
<br />
- PositionEntity light,1000,1000,-1000
<br />
- ground=CreatePlane(2)
<br />
- EntityAlpha ground,0.5
<br />
- EntityColor ground,0,0,255
<br />
- mirror=CreateMirror()
<br />
-
<br />
- ;Lets make a bouncing ball that squashes on impact with the floor.
<br />
- ball=CreateSphere(16)
<br />
- EntityShininess ball,1
<br />
- EntityColor ball,255,0,0
<br />
-
<br />
- ; Lets animate him and "record" the 3D animation for later playback
<br />
- bloat#=0 : flatten#=0 : ypos#=10
<br />
-
<br />
- For frame=1 To 10
<br />
- ;Drop the ball from height 10 to 2
<br />
- ypos = ypos - spd#
<br />
- spd#=spd#+.2
<br />
- PositionEntity ball,0,ypos,0
<br />
- ScaleEntity ball,1+bloat,1+flatten,1+bloat
<br />
-
<br />
- ;If the ball is low enough make it look increasingly squashed
<br />
- If frame>8
<br />
- bloat=bloat+1.5
<br />
- flatten=flatten-.25
<br />
- Else
<br />
- flatten=flatten+.05
<br />
- EndIf
<br />
-
<br />
- ;Record the frame!
<br />
- SetAnimKey ball,frame
<br />
- Next
<br />
-
<br />
- ;Now we need to add the frames we've just made to the sequence of "film"!
<br />
- seq = AddAnimSeq(ball,frame-1) ; total number of frames
<br />
-
<br />
- ;Play it back ping-pong!
<br />
- Animate ball,2,0.15
<br />
- While Not KeyHit(1)
<br />
- UpdateWorld
<br />
- RenderWorld
<br />
- Flip
<br />
- Wend
<br />
- End
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=AddAnimSeq&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|