ctrlSetAngle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (description)
m (Some wiki formatting)
 
(75 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|=
{{RV|type=command
____________________________________________________________________________________________
|arma3 |= Game
|1.62|= Game Version
|arg=  |= Multiplayer Arguments
|eff=  |= Multiplayer Effects
____________________________________________________________________________________________
| Sets the rotation of a '''3D'''control. |= Description
____________________________________________________________________________________________
| ctrl ctrlSetAngle angle |= Syntax
|p1= ctrl: [[Control]] |= Parameter 1
|p2= angle: [[Array]] |= Parameter 2


| [[Nothing]] |= Return Value
|game1= arma3
|version1= 1.62


|x1=<code> _control ctrlSetAngle [25, 0.5, 0.5];</code> |= Example 1
|arg= local
____________________________________________________________________________________________


| [[ctrlAngle]] |= See Also
|eff= local
}}
 
|gr1= GUI Control
 
|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:
* [[CT_STATIC]]
* {{GVI|arma3|2.10|size= 0.75}} [[CT_ACTIVETEXT]]
 
{{Feature|important|Images that touch borders may "bleed" during rotation transformation, to avoid this, make sure the image has a 1px transparent padding.}}  
 
|s1= control [[ctrlSetAngle]] [angle, centerX, centerY, now]
 
|p1= control: [[Control]] - picture control
 
|p2= angle: [[Number]] - rotation angle (clockwise)
 
|p3= centerX: [[Number]] - rotation center X in range 0 to 1. Control center is 0.5
 
|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>


<dl class='command_description'>
|x2= <sqf>
<!-- BEGIN Note Section -->
with uiNamespace do
<!-- For example:
{
<dd class='notedate'>Posted on Month Day, Year - Time (UTC)</dd>
ctrl = findDisplay 46 ctrlCreate ["RscPictureKeepAspect", -1];
<dt class='note'>'''[[User:User Name|User Name]]'''</dt>
ctrl ctrlSetPosition [0,0,1,1];
<dd class='note'>This is an example note. It is true and verifiable, and contains a little code snippet.
ctrl ctrlSetText "A3\Missions_F_Exp\data\Img\lobby\ui_campaign_lobby_background_tablet_radial_left_ca.paa";
<code>[[if]] ([[_this]] == anExample) [[then]] { hint: Leave it here for others to read; };</code></dd>
ctrl ctrlCommit 0;
-->
angle = 0;
<!-- END Note Section -->
onEachFrame
</dl>
{
with uiNamespace do
{
if (angle > 359) then { angle = 0 };
ctrl ctrlSetAngle [angle, 0.5, 0.5];
angle = angle + 1;
};
};
};
</sqf>


<h3 style='display:none'>Bottom Section</h3>
|x3= <sqf>
<!-- Appropriate categories go here -->
_control ctrlSetAngle [25, 0.5, 0.5, false];
_control ctrlCommit 1; // Rotation applies smoothly for 1 second.
</sqf>


[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
|seealso= [[ctrlAngle]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}

Latest revision as of 22:41, 30 June 2024

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