mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Shake animation - spawn support
This commit is contained in:
parent
61ce251561
commit
422b3883af
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
Description:
|
Description:
|
||||||
Gives shake animation to your 2D GUI element along it's center.
|
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;
|
_control (mandatory): control to animate;
|
||||||
_speed (optional): speed of animation, higher values equals to faster animation. Should be less than degrees to avoid glitches!
|
_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.
|
_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
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/animations/Epoch_2DCtrlShake.sqf
|
||||||
|
|
||||||
Usage:
|
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, 10, 12] call epoch_2DCtrlShake; //12 very fast shakes
|
||||||
[_control, 2, 5, 90] call epoch_2DCtrlShake; // 5 very slow 90 degree shakes
|
[_control, 2, 5, 90] call epoch_2DCtrlShake; // 5 very slow 90 degree shakes
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
[bool] success
|
[bool] success
|
||||||
*/
|
*/
|
||||||
|
disableSerialization;
|
||||||
private ["_ctrl","_speed","_shakes","_degrees","_s","_d"];
|
private ["_ctrl","_speed","_shakes","_degrees","_s","_d"];
|
||||||
_ctrl = param [0, controlNull,[controlNull]];
|
_ctrl = param [0, controlNull,[controlNull]];
|
||||||
_speed = param [1,5,[0]];
|
_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];
|
_ctrl ctrlSetAngle [_degrees - _d,0.5,0.5];
|
||||||
uiSleep 0.01;
|
uiSleep 0.01;
|
||||||
};
|
};
|
||||||
|
_ctrl ctrlSetAngle [0,0.5,0.5]; // just in case given params are not balanced
|
||||||
};
|
};
|
||||||
|
|
||||||
true
|
true
|
||||||
|
Loading…
Reference in New Issue
Block a user