Lens Scripting API
    Preparing search index...

    Class Rect

    An axis aligned rectangle. Used by anchors and offsets in ScreenTransform to represent screen boundaries. Rect can only store finite numbers in the range Number.MIN_VALUE to Number.MAX_VALUE.

    // @input Component.ScreenTransform screenTransform

    // Move the ScreenTransform's anchor center
    script.screenTransform.anchors.setCenter(new vec2(-0.25, 0.5));

    // Change the ScreenTransform's anchor size
    script.screenTransform.anchors.setSize(new vec2(0.25, 0.25));

    Hierarchy (View Summary)

    Index

    Properties

    bottom: number

    The y position of the rectangle's bottom side.

    left: number

    The x position of the rectangle's left side.

    right: number

    The x position of the rectangle's right side.

    top: number

    The y position of the rectangle's top side.

    Methods

    • Creates a new Rect with the given properties.

      Parameters

      • left: number
      • right: number
      • bottom: number
      • top: number

      Returns Rect

    • Returns the rectangle's center position as (x, y).

      Returns vec2

    • Returns the size of the rectangle as (width, height).

      Returns vec2

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Sets the rectangle's center position while maintaining its size.

      Parameters

      Returns void

    • Sets the rectangle's size while maintaining its center position.

      Parameters

      Returns void

    • Returns a string representation of the Rect.

      Returns string