Skip to content

Animate

Narta Xaymar Dirks edited this page Oct 30, 2026 · 7 revisions
Blitz3D

Animate

Animate:Void entity:Int32, mode:Int32=1, speed:Float32=1, sequence:Int32=0, transition:Float32=0
Parameter Mode Type Default Description
entity In Int32 required The entity to animate.
mode In Int32 1 0 stop, 1 loop, 2 ping-pong, 3 one-shot. Defaults to 1.
speed In Float32 1 Playback speed, negative for backwards. Defaults to 1.
sequence In Int32 0 Number of the sequence to play. Defaults to 0.
transition In Float32 0 Frames (as counted by UpdateWorld) over which the entity blends from its current pose to the first frame of the new animation. Defaults to 0, which jumps right in.

Description

Starts, changes or stops the skeletal or keyframe animation of an entity, such as a character loaded with LoadAnimMesh. The animation then advances every time UpdateWorld runs. Entities that have no animation ignore the call.

Mode Behavior
0 Stop.
1 Loop, jumping back to the start when the end is reached. This is the default.
2 Ping-pong: play to the end, then backwards to the start, and so on.
3 One-shot: play once and then stop at the last frame.

A negative speed plays the sequence backwards. A model has sequence 0 after loading; more sequences come from LoadAnimSeq, AddAnimSeq and ExtractAnimSeq. Calling Animate again with the same mode and sequence only changes the speed and does not restart the animation.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
light = CreateLight()
RotateEntity light, 40, 30, 0

; A box that slides to the right and back, described with two keys.
box = CreateCube()
PositionEntity box, -2, 0, 6 : SetAnimKey box, 0
PositionEntity box, 2, 0, 6 : SetAnimKey box, 30
AddAnimSeq box, 30

Animate box, 2, 1
While Not KeyHit(1)
	UpdateWorld
	RenderWorld
	Text 8, 8, "Time " + AnimTime(box)
	Flip
Wend

Related Commands

AddAnimSeq, AnimateEntity 〔BlitzLLVM〕, AnimateMD2

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally