LookAtFrame

Can calculate distance and angle between two frames. It uses frame’s center as origin point.


Class
CLookAtFrame <— CFrame
Desc
- None -

Description

# Example: Distance with an offset

In the example LookAtFrame is used to build a line connecting two dots on the screen. Additionally it shows how to shorten the line for extra spacing.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Desc>
    <!-- Test22.SC2Layout -->
    <Frame type="Image" name="DotTemplate">
        <Width val="20"/>
        <Height val="20"/>
        <Color val="136,255,73,73"/>
        <Texture val="Assets/Textures/ui_ingame_coop_topbar_stetmann_stetelliteflavordisplay_chargeicon_charged.dds"/>
    </Frame>

    <Frame type="Image" name="ConnectorTemplate">
        <Width val="100"/>
        <Height val="4"/>
        <RotationPosition val="MiddleLeft"/>
        <Color val="136,255,73,73"/>
        <Texture val="Assets/Textures/ui_ingame_coop_topbar_stetmann_stetelliteflavordisplay_connectorgradient.dds"/>
    </Frame>

    <Frame type="LookAtFrame" name="SetupConnectorTemplate">
        <StateGroup name="LazySetup">
            <State name="Init">
                <!--
                    this condition seems to do the needed magic: it won't setup the binding until Distance is calculated
                    and if we attempt to property bind it before it has been calculated we're getting `invalid property binding`
                    the only place where @Distance can be directly bound seems to be `Width` and `Height` properties
                    not entirely sure why, but I believe it's because of some circular dependency which UI cannot handle in this case
                    .. that or, LookAtFrame is partially bugged and @Distance isn't properly initialized?
                    either way, lazyloading solves that
                -->
                <When type="Property" frame="$this" operator="GreaterThan" Distance="0"/>
            </State>
        </StateGroup>

        <Frame type="MathFrame" name="ReducedLength">
            <B val="26"/>
            <!-- ^ offset should be 20, added +3*2 intentionally to show there's actually a gap -->
            <Operator val="Subtract"/>
        </Frame>
    </Frame>

    <Frame type="Frame" name="GameUI/UIContainer" file="GameUI">
        <Frame type="Frame" name="Test22">
            <Anchor side="Top" relative="$parent" pos="Mid" offset="0"/>
            <Anchor side="Left" relative="$parent" pos="Mid" offset="-300"/>
            <Width val="600"/>
            <Height val="600"/>

            <Frame type="Image" name="QuadrantIcon01" template="Test22/DotTemplate">
                <Anchor side="Top" relative="$parent" pos="Min" offset="0"/>
                <Anchor side="Left" relative="$parent" pos="Min" offset="0"/>
            </Frame>

            <Frame type="Image" name="QuadrantIcon02" template="Test22/DotTemplate">
                <Anchor side="Top" relative="$parent" pos="Min" offset="78"/>
                <Anchor side="Left" relative="$parent" pos="Min" offset="430"/>
            </Frame>

            <Frame type="Image" name="Connector_1" template="Test22/ConnectorTemplate">
                <Anchor side="Top" relative="$parent/QuadrantIcon01" pos="Mid" offset="0"/>
                <Anchor side="Bottom" relative="$parent/QuadrantIcon01" pos="Mid" offset="0"/>
                <Anchor side="Left" relative="$parent/QuadrantIcon01" pos="Mid" offset="13"/>
                <!-- ^ offset should be 10, added +3 intentionally to show there's actually a gap -->
                <Width val="{$parent/SetupConnector_1/@Distance}"/>
                <Rotation val="{$parent/SetupConnector_1/@Angle}"/>
            </Frame>

            <Frame type="LookAtFrame" name="SetupConnector_1" template="Test22/SetupConnectorTemplate">
                <SourceFrame val="$parent/QuadrantIcon01"/>
                <DestFrame val="$parent/QuadrantIcon02"/>

                <StateGroup name="LazySetup">
                    <State name="Init">
                        <Action type="SetProperty" frame="ReducedLength" A="{$parent/@Distance}"/>
                        <Action type="SetProperty" frame="$parent/Connector_1" Width="{$parent/SetupConnector_1/ReducedLength/@Result}"/>
                    </State>
                </StateGroup>
            </Frame>
        </Frame>
    </Frame>
</Desc>

Properties

 

— CLookAtFrame

(4)

@ val  
[ FrameReference ]

Path to the source frame.


@ val  
[ FrameReference ]

Path to the destination frame.


@ val  
[ Real32 ]

Distance (expressed in design pixels) from center of SourceFrame to center of TargetFrame.


@ val  
[ Real32 ]

Angle (expressed in degrees: 0-360) from center of SourceFrame to center of TargetFrame

 

— CFrame

(47)

@ val  
[ Boolean ]
False | True

Determines if frame can receive mouse events.(see more)


@ val  
[ Boolean ]
False | True

Determines if frame can accept drag & drop events.(see more)


@ val  
[ Boolean ]
False | True

@ val  
[ Uint8 ]

Determines the transparency of the element, by adjusting its Alpha channel.(see more)


@ val  
[ Boolean ]
False | True

@ val  
[ Image ]

@ side ?
[ AnchorSide ]
Top | Left | Right | Bottom
@ relative  
[ FrameReference ]
@ pos ?
[ AnchorPos ]
@ offset ?
[ Int32 ]

Used to position a frame. A frame can have up to 4 anchors.(see more)


@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

Enables verbose logging of animations defined inside this frame.


@ maxheight ?
[ Int32 ]
@ maxwidth ?
[ Int32 ]
@ minheight ?
[ Int32 ]
@ minwidth ?
[ Int32 ]
@ val ?
[ String ]

@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

Enables blurring the frame and its children. The actual blur factor is determined by BlurAmount.


@ val  
[ Real32 ]

The amount a frame will be blurred. Blur need to be set as True for this feature to work.


@ val  
[ EImageShaderBlendMode ]
Multiply | Add | Alpha | Subtract | Normal | Lighten | Darken

The blending mode used for BlurShader.


@ val  
[ Boolean ]
False | True

Works in conjunction with PreserveAnchorOffset. Generally when a frame is collapsed, other frames anchoring to it will ignore their offsets and will be placed right at the Left and Top anchor of the collpased frame. With PreserveAnchorOffset, anchoring items will preserve their offset.


@ val  
[ Color ]

@ val  
[ ContextMenu ]

@ val  
[ MouseButtons ]
Left | Middle | Right | XButton1 | XButton2 | Shift | Control | Alt | TopToTop | TopToBottom | BottomToTop | BottomToBottom | VCenterToCenter | LeftToLeft | LeftToRight | RightToLeft | RightToRight | HCenterToCenter | TopLeft | TopCenter | TopRight | MiddleLeft | MiddleRight | BottomLeft | BottomCenter | BottomRight

@ val  
[ Boolean ]
False | True

@ val  
[ Uint8 ]

Alpha value when frame is in disabled state


@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

Enables / disables frame. It might have different results that will vary basing on the type of the frame.(see more)


@ val  
[ Handle ]

Unique global identifier. Allows referencing the frame from any place within hierarchy, by using defined handle prefixed with $, i.e. $MyHandle.(see more)


@ val  
[ Real32 ]

Height of the frame(see more)


@ val  
[ Image ]

@ alias  
[ FrameReference ]
@ original  
[ String ]

Allows to define an alias that can be used for redirecting the hookup action, which is used to retrieve named FrameDesc within the current frame.(see more)


@ val  
[ Boolean ]
False | True

Allows a child element to ignore the Alpha settings of its parent


@ val  
[ Boolean ]
False | True

Allows a child element to ignore the color settings of its parent


@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

Works in conjunction with CollapseLayout. Generally when a frame its collapsed, other frames anchoring to it will ignore their offsets and be placed right at the Left and Top anchor of the collpased frame. With this property, anchoring items will preserve their offset.


@ val  
[ Uint16 ]

Render priority of the element (512 is default value). Frames with higher priority will render on top of others.(see more)


@ val  
[ ERenderType ]
RTT | HDR | Offscreen | LDR

Render type of the element(see more)


@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

@ val  
[ Text ]

@ val  
[ TooltipAnchorPosition ]
TopToTop | TopToBottom | BottomToTop | BottomToBottom | VCenterToCenter | LeftToLeft | LeftToRight | RightToLeft | RightToRight | HCenterToCenter | TopLeft | TopCenter | TopRight | MiddleLeft | MiddleRight | BottomLeft | BottomCenter | BottomRight

@ val  
[ Boolean ]
False | True

@ val  
[ Tooltip ]

@ val  
[ Boolean ]
False | True

Allows a frame to be rendered outside its parent countainer bounds.(see more)


@ val  
[ Boolean ]
False | True

Specifies which kind of time should be used for animations of this frame.(see more)


@ val  
[ Boolean ]
False | True

@ val  
[ Boolean ]
False | True

Determines whether animations that use Fade controller will toggle Visibility state of the frame, once they’re finished.


@ val  
[ Boolean ]
False | True

Determines visibility of the frame.


@ val  
[ Real32 ]

Width of the frame(see more)