---
name: "BIS_fnc_animateFlag"
type: function
status: ok
groups: ["Object Manipulation"]
arma3_since: "1.68"
locality: {"argument": "global", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_animateFlag
revid: 364735
updated: 2024-05-30T21:39:57Z
---

# BIS_fnc_animateFlag

*Function · Object Manipulation · Arma 3 v1.68*

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

## Description

Smoothly animates given flag from current position on the flag pole to the given position. When flag animation is done, the [scripted event handler](../topics/Scripted_Event_Handlers.md) ["FlagAnimationDone"](../topics/Scripted_Event_Handlers.md#bis_fnc_animateflag) is called.

## Syntax

```sqf
[flag, phase, instant] call BIS_fnc_animateFlag
```

**Parameters:**

- `flag`: [Object](../topics/Object.md) - [flag](../commands/flag.md) object of the type "FlagCarrier"
- `phase`: [Number](../topics/Number.md) - desired animation phase 0..1 (0 - bottom of the flag pole, 1 - top of the flag pole)
- instant (Optional, default [false](../commands/false.md)):
  - [Boolean](../topics/Boolean.md) - when [true](../commands/true.md), animation is instant ("FlagAnimationDone" EH is not called in this case)
  - [Number](../topics/Number.md) - animation duration multiplier

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

## Examples

### Example 1

```sqf
[flag1, 0] call BIS_fnc_animateFlag;
```

### Example 2

```sqf
// Adding the "FlagAnimationDone" EH
private _eh = [<yourflag>, "FlagAnimationDone", { /* your code */ }] call BIS_fnc_addScriptedEventHandler;
```

## Multiplayer

The effect is global, MP compatible and its effect is persistent.

## See also

[flag](../commands/flag.md) · [flagOwner](../commands/flagOwner.md) · [setFlagOwner](../commands/setFlagOwner.md) · [setFlagSide](../commands/setFlagSide.md) · [setFlagTexture](../commands/setFlagTexture.md) · [flagSide](../commands/flagSide.md) · [flagTexture](../commands/flagTexture.md) · [setFlagAnimationPhase](../commands/setFlagAnimationPhase.md) · [flagAnimationPhase](../commands/flagAnimationPhase.md) · Arma 3: Flag Textures

## Community notes

**Killzone_Kid** — 2016-12-12

Flag Demo (https://www.youtube.com/watch?v=sJtQfRML0cc)

```sqf
fnc_addFlagAction =
{
    _this addAction
    [
        "Pull The Cord",
        {
            player playAction "PutDown";
            sleep 0.5;
            [_this select 0, flagAnimationPhase (_this select 0) + 0.2, 0.2] call BIS_fnc_animateFlag;
            _this select 0 removeAction (_this select 2);
        },
        "",
        10,
        true,
        true,
        "",
        "_this distance2D _target < 2"
    ];
};

private _flag = createVehicle ["Flag_BI_F", player getRelPos [10, 0], [], 0, "CAN_COLLIDE"];
[_flag, 0, true] call BIS_fnc_animateFlag;
_flag call fnc_addFlagAction;

[
    _flag,
    "FlagAnimationDone",
    {
        if (_this select 1 > 0.9) exitWith
        {
            [_this select 0, "FlagAnimationDone"] call BIS_fnc_removeAllScriptedEventHandlers;
            removeAllActions (_this select 0);
        };
        _this select 0 call fnc_addFlagAction;
    }
]
call BIS_fnc_addScriptedEventHandler;
```

<sub>Source: [BI Community Wiki — BIS fnc animateFlag](https://community.bistudio.com/wiki/BIS_fnc_animateFlag) (revision 364735).</sub>
