{"name":"BIS_fnc_animateFlag","title":"BIS fnc animateFlag","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_animateFlag","revid":379244,"updated":"2026-10-30T23:23:22Z","groups":["Object Manipulation"],"status":"ok","games":{"arma3":"1.68"},"since":"arma3 1.68","arma3_since":"1.68","locality":{"argument":"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 \"FlagAnimationDone\" is called.","syntaxes":[{"syntax":"[flag, phase, instant] call BIS_fnc_animateFlag","params":[{"name":"flag","type":"Object","description":"flag object of the type \"FlagCarrier\"","type_expr":"Object"},{"name":"phase","type":"Number","description":"desired animation phase 0..1 (0 - bottom of the flag pole, 1 - top of the flag pole)","type_expr":"Number"},{"name":"instant","type":"Boolean or Number","optional":true,"default":"false","description":"Boolean - when true, animation is instant (\"FlagAnimationDone\" EH is not called in this case)\n- Number - animation duration multiplier","type_expr":"Boolean | Number","text":"instant: Boolean or Number - (Optional, default false)\n\n- Boolean - when true, animation is instant (\"FlagAnimationDone\" EH is not called in this case)\n- Number - animation duration multiplier"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[flag1, 0] call BIS_fnc_animateFlag;"]},{"code":["// Adding the \"FlagAnimationDone\" EH\nprivate _eh = [<yourflag>, \"FlagAnimationDone\", { /* your code */ }] call BIS_fnc_addScriptedEventHandler;"]}],"multiplayer":"The effect is global, MP compatible and its effect is persistent.","see_also":["flag","flagOwner","setFlagOwner","setFlagSide","setFlagTexture","flagSide","flagTexture","setFlagAnimationPhase","flagAnimationPhase","Arma 3: Flag Textures"],"notes":[{"user":"Killzone_Kid","date":"2016-12-12T20:02:00Z","text":"Flag Demo (https://www.youtube.com/watch?v=sJtQfRML0cc)\n\n```sqf\nfnc_addFlagAction =\n{\n    _this addAction\n    [\n        \"Pull The Cord\",\n        {\n            player playAction \"PutDown\";\n            sleep 0.5;\n            [_this select 0, flagAnimationPhase (_this select 0) + 0.2, 0.2] call BIS_fnc_animateFlag;\n            _this select 0 removeAction (_this select 2);\n        },\n        \"\",\n        10,\n        true,\n        true,\n        \"\",\n        \"_this distance2D _target < 2\"\n    ];\n};\n\nprivate _flag = createVehicle [\"Flag_BI_F\", player getRelPos [10, 0], [], 0, \"CAN_COLLIDE\"];\n[_flag, 0, true] call BIS_fnc_animateFlag;\n_flag call fnc_addFlagAction;\n\n[\n    _flag,\n    \"FlagAnimationDone\",\n    {\n        if (_this select 1 > 0.9) exitWith\n        {\n            [_this select 0, \"FlagAnimationDone\"] call BIS_fnc_removeAllScriptedEventHandlers;\n            removeAllActions (_this select 0);\n        };\n        _this select 0 call fnc_addFlagAction;\n    }\n]\ncall BIS_fnc_addScriptedEventHandler;\n```"}]}