Shake animation - spawn support

This commit is contained in:
Raymix 2016-11-09 22:13:54 +00:00
parent 61ce251561
commit 422b3883af

View File

@ -5,6 +5,8 @@
Description:
Gives shake animation to your 2D GUI element along it's center.
***Warning*** Consider spawning when animating multiple elements from a loop
_control (mandatory): control to animate;
_speed (optional): speed of animation, higher values equals to faster animation. Should be less than degrees to avoid glitches!
_shakes (optional): amount of shakes, more shakes = longer animation.
@ -22,14 +24,14 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/animations/Epoch_2DCtrlShake.sqf
Usage:
[_control] call epoch_2DCtrlShake; //default 3 fast shakes
[_control] spawn epoch_2DCtrlShake; //default 3 fast shakes
[_control, 10, 12] call epoch_2DCtrlShake; //12 very fast shakes
[_control, 2, 5, 90] call epoch_2DCtrlShake; // 5 very slow 90 degree shakes
Returns:
[bool] success
*/
disableSerialization;
private ["_ctrl","_speed","_shakes","_degrees","_s","_d"];
_ctrl = param [0, controlNull,[controlNull]];
_speed = param [1,5,[0]];
@ -52,7 +54,7 @@ for "_s" from 0 to (_shakes - 1) do {
_ctrl ctrlSetAngle [_degrees - _d,0.5,0.5];
uiSleep 0.01;
};
_ctrl ctrlSetAngle [0,0.5,0.5]; // just in case given params are not balanced
};
true