Page tree
Skip to end of metadata
Go to start of metadata

Introduced in



Description:Process a linear animation on an object. Linear animations are only used in user-made addons, and can be defined in the addon config.cpp. To get the list of possible animations for an object, use getAnimations (V3.7+).


Syntax:object animate [animationName, phase, duration, sound, override]
  • object: Object - The object.
  • animationName: String - Name of the animation (the class name of the animation, defined in the addon config.cpp). Some in-game objects have animation names that end with _hide, those cause the animated element to be hidden, once a certain animation threshold has been reached (for doors, it is normally 1).
  • phase: Number - The animation phase (see animationPhase) the selected part should be set to. The range is normally between 0 and 1, but some animations could be configured for different ranges (use getAnimInfo to find the applicable values). The speed in which the animation is processed, is defined in the addon config.cpp and cannot be changed during the mission.
  • duration: Number - How long should the whole animation take to finish (from 0 to 1) (optional, default: 0, V1.40+).
  • sound: Array - Sound to be played during the animation (optional, default: [], V1.50+).
    The array contains the following parameters:
    • soundClass: String - Class name that is defined in CfgSounds (see Class CfgSounds in the VBS Developer Reference).
    • soundLength: Number - Duration in seconds to take to play the full sound file. Passing -1 does not modify the sound file duration (default: -1).
    • matchAnimPhase: Boolean - If true, the sound file start location is synchronized with the animation current phase. For example, if the animation phase is 0.5, then the sound file starts half way through. Also, when the animation finishes, the sound file stops playing. If set to false, then the sound file starts from the very beginning, and the length is defined by soundLength parameter.
    • matchAnimLength: Boolean - If true, the sound file length is set to the animPeriod only if animPeriod is greater than zero. Otherwise, if still true, and animPeriod is less than or equal to zero, the sound file is played with an animation length of 1 second. If false, the sound file length is unmodified and soundLength is used to define the sound file length.
    • publicBroadcast: Boolean - If true, the command is broadcast to all multiplayer clients. If false, the sound file is only heard on the computer, where the object is local.
  • override: Boolean - Allows the control of engine-driven animations. When the override parameter is true, a new animation source is created to control the selected animation. This animation is then no longer controlled by the engine. The original behavior can be restored by setting this parameter to false (optional, default: false, V3.7+).
Return Value:Nothing


// Animate a building door
_building animate ["maindoor", 1]; 

// Animate with sound effects
door1 animate ["door_1",0,5,["fanfare",5,false]]; 

// Override engine animation for vehicle steering wheel
car1 animate ["DrivingWheel",1,0,[],true]; 

Demonstration of animated gates and targets

Additional Information

See also: animationPhase, animateSource, getAnimations, animationExists, animationState, setSimulationParameter