---
name: "animateSource"
type: command
status: ok
groups: ["Animations"]
arma3_since: "1.58"
locality: {"argument": "global", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/animateSource
revid: 353025
updated: 2024-03-12T11:30:02Z
---

# animateSource

*Command · Animations · Arma 3 v1.58*

Locality: arguments **global** · effect **global**

## Description

Process an animation of the object. If [animate](../commands/animate.md) uses class name from CfgModels *Animations*, [animateSource](../commands/animateSource.md) uses name defined by the *source* property. AnimationSources can animate multiple [animate](../commands/animate.md) Animations. AnimationSource is defined in CfgVehicles' AnimationSources (see Arma 3: createVehicle/vehicles).

> [!NOTE]
> **Arma 3:** It is recommended that [animateSource](../commands/animateSource.md) command is used instead of [animate](../commands/animate.md) whenever is possible, as it is more efficient and optimized for MP

> [!WARNING]
> Mixing [animateSource](../commands/animateSource.md) command with [animate](../commands/animate.md) command to animate the same part may produce some undefined behaviour.

## Syntax

```sqf
object animateSource [source, phase, speed]
```

**Parameters:**

- `object`: [Object](../topics/Object.md)
- `source`: [String](../topics/String.md) - common source
- `phase`: [Number](../topics/Number.md) - wanted animation phase
- `speed`: [Boolean](../topics/Boolean.md) or [Number](../topics/Number.md) - (Optional, default [false](../commands/false.md))
  - [Boolean](../topics/Boolean.md) - when set to [true](../commands/true.md), animation is instant
  - Arma 3 v1.66 [Number](../topics/Number.md) > 0 is treated as config speed value multiplier. Since Arma 3 v2.10 values <= 0 will instantly reset animation to initPhase.

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
house animateSource ["Door_1_source", 1, true];
```

### Example 2

Create UGV and manipulate its turret (Not possible to do with [animate](../commands/animate.md) command. See Arma 3: createVehicle/vehicles for reference)

```sqf
ugv = "B_UGV_01_F" createVehicle (player getRelPos [5, 0]);
ugv addAction ["Show Turret",
{
    ugv animateSource ["Turret", 0];
    ugv animateSource ["MainTurret", rad 0, true];
    ugv animateSource ["MainGun", rad 0, true];
}];
ugv addAction ["Hide Turret",    { ugv animateSource ["Turret", 1] }];
ugv addAction ["Turret Left",    { ugv animateSource ["MainTurret",     rad 90] }];
ugv addAction ["Turret Right",    { ugv animateSource ["MainTurret",    -rad 90] }];
ugv addAction ["Turret Up",        { ugv animateSource ["MainGun",         rad 30] }];
ugv addAction ["Turret Down",    { ugv animateSource ["MainGun",        -rad 20] }];
```

### Example 3

```sqf
barGate animateSource ["Door_1_sound_source", 1]; // Open
barGate animateSource ["Door_1_sound_source", 0]; // Close
```

### Example 4

Open/close Bar Gate automatically:

```sqf
// Bar Gate init
if (isServer) then
{    
    private _gateTrigger = createTrigger ["EmptyDetector", getPosWorld this, false];
    _gateTrigger setVariable ["BarGateObj", this];
    _gateTrigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
    _gateTrigger setTriggerArea [5, 25, getDir this, true];
    _gateTrigger setTriggerStatements 
    [
        "this",
        "thisTrigger getVariable 'BarGateObj' animateSource ['Door_1_sound_source', 1]",
        "thisTrigger getVariable 'BarGateObj' animateSource ['Door_1_sound_source', 0]"
    ];
};
```

## See also

[animationSourcePhase](../commands/animationSourcePhase.md) · [setFaceAnimation](../commands/setFaceAnimation.md) · [animate](../commands/animate.md) · [animationPhase](../commands/animationPhase.md) · [animateDoor](../commands/animateDoor.md) · [doorPhase](../commands/doorPhase.md) · [animationNames](../commands/animationNames.md)

<sub>Source: [BI Community Wiki — animateSource](https://community.bistudio.com/wiki/animateSource) (revision 353025).</sub>
