Lens Scripting API

    This class provides visual feedback for different types of buttons, such as Pinch Button, Toggle Button, and State Button. It allows customization of the button's appearance and behavior based on its state.

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    api: Record<string, any>

    Generic object accessible by other instances of ScriptComponent. Use this object to store references to properties and methods that need to be accessible from other ScriptComponents.

    buttonType: number = 0

    Defines the interactive behavior and visual feedback style of the button:

    • Pinch Button: Standard button with hover/pinch states.
    • Toggle Button: Switches between on/off states and maintains state after interaction.
    • State Button: Similar to toggle button but with optional Persistent Pinched State.
    defaultIcon: Texture

    The texture displayed on the button in its default state (not toggled). Applied to idle, hover, and pinched materials.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    glowBlendShapeName: string = "Pinch"

    References the blend shape on the glow mesh that will be animated during interactions. Must match an existing blend shape name in your glow mesh. This controls the shape animation of the glow effect as the button is interacted with.

    glowHoverMaterial: Material

    The material applied to the glow mesh when a user's hand is hovering over the button.

    glowIdleMaterial: Material

    The material applied to the glow mesh when the button is in its default state (not being interacted with).

    glowPinchedMaterial: Material

    The material applied to the glow mesh when the user is actively interacting with the button.

    glowRenderMeshVisual?: RenderMeshVisual

    The secondary mesh that displays the glow effect around the button. This mesh will receive its own material changes and blend shape animations independent from the main button mesh during interactions.

    maxBlendShapeWeight: number = 1.0

    Controls the maximum intensity of the button's deformation effect when interacted with. This scales the weight applied to the mesh's blend shape (defined by Mesh Blend Shape Name). Higher values create more pronounced visual feedback during interactions. Range: 0.0 (no effect) to 1.0 (maximum effect).

    meshBlendShapeName: string = "Pinch"

    References the blend shape on the button mesh that will be animated during interactions. Must match an existing blend shape name in your mesh. Default is "Pinch", but should be set to match a blend shape available in your mesh.

    meshHoverMaterial: Material

    The material applied to the button when an Interactor is hovering over it.

    meshIdleMaterial: Material

    The material applied to the button when not being interacted with (idle state).

    meshPinchedMaterial: Material

    The material applied to the button when the user is actively interacting with it.

    meshStateHoverMaterial: Material

    The material applied to the State Button when a user's hand is hovering over it.

    meshStateIdleMaterial: Material

    The material applied to the State Button when it's in its default state (not being interacted with).

    meshStatePinchedMaterial: Material

    The material applied to the State Button when it's being actively interacted with. This provides visual feedback during interaction and may remain applied after the interaction ends if persistentPinchedState is enabled.

    meshToggledHoverMaterial: Material

    The material applied to the button when it's in the toggled "on" state AND being hovered over.

    meshToggledIdleMaterial: Material

    The material applied to the button when it's in the toggled "on" state and not being interacted with.

    meshToggledPinchedMaterial: Material

    The material applied to the toggled button when the user is actively interacting with it.

    name: string
    onIcon: Texture

    The texture displayed when the button is toggled on. Replaces defaultIcon for toggle and state buttons when activated.

    persistentPinchedState: boolean = false

    When enabled, the State Button will maintain its pressed visual appearance after interaction ends while in the toggled state.

    renderMeshVisual: RenderMeshVisual

    The RenderMeshVisual component of the button that will be used for ButtonFeedback.

    sceneObject: SceneObject

    The scene object this component is on.

    uniqueIdentifier: string
    updatePriority: number
    useGlowMesh: boolean = false

    When enabled, adds a glow effect to the button that can be independently animated with its own materials and blend shapes during interactions.

    Methods

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

      Parameters

      • type: string

      Returns boolean

    • Returns void

    MMNEPVFCICPMFPCPTTAAATR