{"name":"BIS_fnc_shakeMapEH","title":"BIS fnc shakeMapEH","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_shakeMapEH","revid":379573,"updated":"2026-10-31T14:01:25Z","groups":["Map and Markers","Event Handlers"],"status":"ok","games":{"arma3":"1.78"},"since":"arma3 1.78","arma3_since":"1.78","description":"Event handler function of BIS_fnc_shakeMap. BIS_fnc_shakeMap adds it as a \"Draw\" event handler to the main map control (display 12, control 51), so it runs every frame the map is drawn.\nWhile the shake lasts, it moves the map view to a random point within *magnitude* metres of the shake center on both axes; the movement fades out during the last quarter of the duration. When the duration has elapsed, it removes the event handler whose ID is stored in the *BIS_shakeMapEventId* variable of missionNamespace.\nIt is meant for internal use; use BIS_fnc_shakeMap to shake the map.","syntaxes":[{"syntax":"[duration, magnitude, center, startTime] call BIS_fnc_shakeMapEH","params":[{"name":"duration","type":"Number","optional":true,"default":"2","description":"duration of the shake in seconds","type_expr":"Number","text":"duration: Number - (Optional, default 2) duration of the shake in seconds"},{"name":"magnitude","type":"Number","optional":true,"default":"20","description":"maximum offset of the map view, in metres","type_expr":"Number","text":"magnitude: Number - (Optional, default 20) maximum offset of the map view, in metres"},{"name":"center","type":"Array format Position","optional":true,"default":"[0,0,0]","description":"position around which the map shakes","type_expr":"Position","types":["Array","Position"],"text":"center: Array format Position - (Optional, default [0,0,0]) position around which the map shakes"},{"name":"startTime","type":"Number","optional":true,"default":"0","description":"time at which the shake started","type_expr":"Number","text":"startTime: Number - (Optional, default 0) time at which the shake started"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"text":"How BIS_fnc_shakeMap adds the handler:\n\n```sqf\nprivate _map = findDisplay 12 displayCtrl 51;\nprivate _code = format [\"[%1, %2, %3, %4] call BIS_fnc_shakeMapEH\", 2, 20, getPosWorld player, time];\nBIS_shakeMapEventId = _map ctrlAddEventHandler [\"Draw\", _code];\n```","code":["private _map = findDisplay 12 displayCtrl 51;\nprivate _code = format [\"[%1, %2, %3, %4] call BIS_fnc_shakeMapEH\", 2, 20, getPosWorld player, time];\nBIS_shakeMapEventId = _map ctrlAddEventHandler [\"Draw\", _code];"]}],"see_also":["BIS_fnc_shakeMap","ctrlMapAnimAdd","ctrlAddEventHandler"]}