New: GUI Animation - Shake

This commit is contained in:
Raymix 2016-11-09 21:55:35 +00:00
parent c15ea5c42b
commit 6fbf5bdfb0
2 changed files with 60 additions and 0 deletions

View File

@ -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

View File

@ -192,6 +192,11 @@ class CfgClientFunctions
class getColorScheme {}; class getColorScheme {};
class dragControl {}; class dragControl {};
}; };
class animations
{
file = "epoch_code\gui\scripts\animations";
class 2DCtrlShake {};
};
class config class config
{ {
file = "epoch_code\gui\scripts\config"; file = "epoch_code\gui\scripts\config";