ctrlSetAngle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *R([a-z ])" to "$1 - r$2")
 
(46 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________
|arma3 |Game name=
|1.62|Game Version=
|arg=  |Multiplayer Arguments=
|eff=  |Multiplayer Effects=


|gr1= GUI Control |GROUP1=
|game1= arma3
____________________________________________________________________________________________
|version1= 1.62
| Sets the rotation of an <tt>ST_PICTURE</tt> control. Rotation will be done within the control boundaries, so if the X and Y are given off center, the picture may get clipped by the control boundaries. Doesn't require [[ctrlCommit]]. Procedural textures filled controls do not rotate.|DESCRIPTION=
____________________________________________________________________________________________
| control [[ctrlSetAngle]] [angle, centerX, centerY] |SYNTAX=
|p1= control: [[Control]] - picture control |PARAMETER1=
|p2=  [angle, centerX, centerY]: [[Array]] |Parameter2=


|p3= angle: [[Number]] - Rotation angle (clockwise) |PARAMETER3=
|arg= local
|p4= centerX: [[Number]] - Rotation center X in range 0 to 1 (0.5 - control center) |PARAMETER4=
|p5= centerY: [[Number]] - Rotation center Y in range 0 to 1 (0.5 - control center)|PARAMETER5=


| [[Nothing]] |RETURNVALUE=
|eff= local


| s2= control [[ctrlSetAngle]] [angle, centerX, centerY, now] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (''Since Arma 3 v1.78.143717'') |SYNTAX2=
|gr1= GUI Control


|p21= control: [[Control]] - picture control |PARAMETER21=
|descr= Sets the rotation of a control set as {{hl|ST_PICTURE}}. Rotation will be done within the control boundaries, so if the X and Y are given off center, the picture may get clipped by the control boundaries. Only requires [[ctrlCommit]] when fourth parameter is set to [[false]]. Procedural textures filled controls do not rotate. Supported control types:
|p22=  [angle, centerX, centerY]: [[Array]] |PARAMETER22=
* [[CT_STATIC]]
|p23= angle: [[Number]] - Rotation angle (clockwise) |PARAMETER23=
* [[CT_ACTIVETEXT]] (Since Arma 3 v2.09.149642)


|p24= centerX: [[Number]] - Rotation center X in range 0 to 1 (0.5 - control center) |PARAMETER24=
{{Feature|important|Images that touch borders may "bleed" during rotation transformation, to avoid this, make sure the image has 1px transparent padding}}


|p25= centerY: [[Number]] - Rotation center Y in range 0 to 1 (0.5 - control center)|PARAMETER25=
|s1= control [[ctrlSetAngle]] [angle, centerX, centerY, now]


|p26= now: [[Boolean]] ''(default: [[true]])'' - if [[false]] control will wait for [[ctrlCommit]] input for result to apply  |PARAMETER26=
|p1= control: [[Control]] - picture control


|r2= [[Nothing]] |RETURNVALUE2=
|p2= angle: [[Number]] - rotation angle (clockwise)


|x1=<code> _control [[ctrlSetAngle]] [25, 0.5, 0.5];</code> |EXAMPLE1=
|p3= centerX: [[Number]] - rotation center X in range 0 to 1. Control center is 0.5
|x2=<code>[[with]] [[uiNamespace]] [[do]]
 
|p4= centerY: [[Number]] - rotation center Y in range 0 to 1. Control center is 0.5
 
|p5= now: [[Boolean]] - (Optional, default [[true]]) if [[false]], control will wait for [[ctrlCommit]] input for result to apply
|p5since= arma3 1.78
 
|r1= [[Nothing]]
 
|x1= <sqf>_control ctrlSetAngle [25, 0.5, 0.5];</sqf>
 
|x2= <sqf>with uiNamespace do
{
{
ctrl = [[findDisplay]] 46 [[ctrlCreate]] ["RscPictureKeepAspect", -1];  
ctrl = findDisplay 46 ctrlCreate ["RscPictureKeepAspect", -1];
ctrl [[ctrlSetPosition]] [0,0,1,1];  
ctrl ctrlSetPosition [0,0,1,1];
ctrl [[ctrlSetText]] "A3\Missions_F_Exp\data\Img\lobby\ui_campaign_lobby_background_tablet_radial_left_ca.paa";  
ctrl ctrlSetText "A3\Missions_F_Exp\data\Img\lobby\ui_campaign_lobby_background_tablet_radial_left_ca.paa";
ctrl [[ctrlCommit]] 0;
ctrl ctrlCommit 0;
angle = 0;
angle = 0;
[[onEachFrame]]
onEachFrame
{
{
[[with]] [[uiNamespace]] [[do]]
with uiNamespace do
{
{
[[if]] (angle > 359) [[then]] {angle = 0};  
if (angle > 359) then {angle = 0};
ctrl [[ctrlSetAngle]] [angle, 0.5, 0.5];  
ctrl ctrlSetAngle [angle, 0.5, 0.5];
angle = angle + 1;
angle = angle + 1;
};
};
};
};
};</code>|Example2=
};</sqf>
|x3=<code>_control [[ctrlSetAngle]] [25, 0.5, 0.5, [[false]]];
_control [[ctrlCommit]] 1; // Rotation applies smoothly for 1 second.
</code> |EXAMPLE3=
____________________________________________________________________________________________


| [[ctrlAngle]] |SEEALSO=
|x3= <sqf>_control ctrlSetAngle [25, 0.5, 0.5, false];
_control ctrlCommit 1; // Rotation applies smoothly for 1 second.</sqf>
 
|seealso= [[ctrlAngle]]
}}
}}
<dl class='command_description'>
<!-- BEGIN Note Section -->
<!-- For example:
<dd class='notedate'>Posted on Month Day, Year - Time (UTC)</dd>
<dt class='note'>'''[[User:User Name|User Name]]'''</dt>
<dd class='note'>This is an example note. It is true and verifiable, and contains a little code snippet.
<code>[[if]] ([[_this]] == anExample) [[then]] { hint: Leave it here for others to read; };</code></dd>
-->
<!-- END Note Section -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
<!-- Appropriate categories go here -->
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]]

Latest revision as of 16:47, 8 November 2023

Hover & click on the images for description

Description

Description:
Sets the rotation of a control set as ST_PICTURE. Rotation will be done within the control boundaries, so if the X and Y are given off center, the picture may get clipped by the control boundaries. Only requires ctrlCommit when fourth parameter is set to false. Procedural textures filled controls do not rotate. Supported control types:
Images that touch borders may "bleed" during rotation transformation, to avoid this, make sure the image has 1px transparent padding
Groups:
GUI Control

Syntax

Syntax:
control ctrlSetAngle [angle, centerX, centerY, now]
Parameters:
control: Control - picture control
angle: Number - rotation angle (clockwise)
centerX: Number - rotation center X in range 0 to 1. Control center is 0.5
centerY: Number - rotation center Y in range 0 to 1. Control center is 0.5
since Arma 3 logo black.png1.78
now: Boolean - (Optional, default true) if false, control will wait for ctrlCommit input for result to apply
Return Value:
Nothing

Examples

Example 1:
_control ctrlSetAngle [25, 0.5, 0.5];
Example 2:
with uiNamespace do { ctrl = findDisplay 46 ctrlCreate ["RscPictureKeepAspect", -1]; ctrl ctrlSetPosition [0,0,1,1]; ctrl ctrlSetText "A3\Missions_F_Exp\data\Img\lobby\ui_campaign_lobby_background_tablet_radial_left_ca.paa"; ctrl ctrlCommit 0; angle = 0; onEachFrame { with uiNamespace do { if (angle > 359) then {angle = 0}; ctrl ctrlSetAngle [angle, 0.5, 0.5]; angle = angle + 1; }; }; };
Example 3:
_control ctrlSetAngle [25, 0.5, 0.5, false]; _control ctrlCommit 1; // Rotation applies smoothly for 1 second.

Additional Information

See also:
ctrlAngle

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note