; SetAnimKey Example ; ------------------ Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,3,-10 light=CreateLight() RotateEntity light,45,45,0 ground=CreatePlane() EntityTexture ground,LoadTexture("media/MossyGround.BMP") ; A bouncing beach ball to animate ball=CreateSphere(16) EntityColor ball,255,60,60 ; Record the bounce: position the ball along an arc and store one ; animation key per frame with SetAnimKey For frame=0 To 40 x#=frame*0.2-4 y#=Abs(Sin(frame*18))*3+0.5 PositionEntity ball,x,y,0 SetAnimKey ball,frame Next ; Bake the recorded keys into a playable sequence seq=AddAnimSeq(ball,40) ; Play the recording back ping-pong, so the ball bounces there and back Animate ball,2,0.5,seq While Not KeyDown(1) UpdateWorld ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Arrows: camera Esc: exit" Text 0,20,"SetAnimKey recorded 41 keys, now playing back AnimTime: "+AnimTime(ball) Flip Wend End