diff --git a/Sources/epoch_code/gui/scripts/animations/Epoch_2DCtrlShake.sqf b/Sources/epoch_code/gui/scripts/animations/Epoch_2DCtrlShake.sqf new file mode 100644 index 00000000..25f3b2b8 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/animations/Epoch_2DCtrlShake.sqf @@ -0,0 +1,55 @@ +/* + Author: Raimonds Virtoss - EpochMod.com + + Contributors: + + Description: + Gives shake animation to your 2D GUI element along it's center. + _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. + _degrees (optional): rotation degrees 0 to 360. + + Shake animation sequence: + 0 > -degrees + -degrees > +degrees + +degrees > 0 + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + 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, 10, 12] call epoch_2DCtrlShake; //12 very fast shakes + [_control, 2, 5, 90] call epoch_2DCtrlShake; // 5 very slow 90 degree shakes +*/ + +private ["_ctrl"]; +_ctrl = param [0, controlNull,[controlNull]]; +_speed = param [1,5,[0]]; +_shakes = param [2,3,[0]]; +_degrees = param [3,10,[0]]; + +if (_ctrl isEqualTo controlNull) exitWith {false}; + +for "_s" from 0 to (_shakes - 1) do { + + for "_d" from 0 to _degrees step _speed do { + _ctrl ctrlSetAngle [_d * -1,0.5,0.5]; + uiSleep 0.01; + }; + for "_d" from (_degrees * -1) to _degrees step _speed do { + _ctrl ctrlSetAngle [_d,0.5,0.5]; + uiSleep 0.01; + }; + for "_d" from 0 to _degrees step _speed do { + _ctrl ctrlSetAngle [_degrees - _d,0.5,0.5]; + uiSleep 0.01; + }; + +}; + +true diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index d6721cc3..f91ec8df 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -192,6 +192,11 @@ class CfgClientFunctions class getColorScheme {}; class dragControl {}; }; + class animations + { + file = "epoch_code\gui\scripts\animations"; + class 2DCtrlShake {}; + }; class config { file = "epoch_code\gui\scripts\config";