Skip to main content

CompositionLayerComponent

Class

Represents a composition layer that is rendered independently from the main scene and composited by the system compositor.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported — SPECS only
  • SPECSFully supported
  • Camera Kit WebNot supported — SPECS only
  • Camera Kit MobileNot supported — SPECS only

Platform details

  • Snapchat — Not supported — SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — SPECS only.

  • Camera Kit Mobile — Not supported — SPECS only.

Since Lens Scripting v370

Represents a composition layer that is rendered independently from the main scene and composited by the system compositor. The type of the layer determines the underlying geometry (e.g. Quad).

Index

Remarks

The composition layer is hidden in capture or in display when its SceneObject's layer is in ScriptScene#hiddenInCapture or ScriptScene#hiddenInDisplay respectively.

Extends

Properties

anchorId

anchorId: string

ExperimentalSPECS only

An optional anchor identifier for attaching this composition layer to a tracked anchor. When set, the layer's pose is driven by the anchor system instead of the SceneObject transform.

Since

Lens Scripting Version 370

Default Value

""
@experimental
@wearableOnly

enabled

enabled: boolean

If disabled, the Component will stop enacting its behavior.

Default Value

true

Inherited from

Component.enabled


isBeingDestroyed

readonly isBeingDestroyed: boolean

Returns true if this Component is currently being destroyed. Becomes true as soon as destruction begins via Component#destroy or destruction of its owning SceneObject, before any OnDestroyEvent callbacks fire.

Since

Lens Scripting Version 364

Example

if (!script.isBeingDestroyed) {
// Component is still fully alive
}

Inherited from

Component.isBeingDestroyed


isEnabledInHierarchy

readonly isEnabledInHierarchy: boolean

Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

Inherited from

Component.isEnabledInHierarchy


renderOrder

renderOrder: number

SPECS only

Back-to-front render order: higher values render in front, lower (negative) values behind. The main projection layer is at 0, so a positive value renders the layer in front of it, a negative behind.

Since

Lens Scripting Version 370

Default Value

0
@wearableOnly

sceneObject

readonly sceneObject: SceneObject

The SceneObject this component is on.

Inherited from

Component.sceneObject


smoothFollowDurationSec

smoothFollowDurationSec: number

SPECS only

The duration in seconds for the composition layer to smooth follow the camera. Only used if smoothFollowEnabled is true.

Since

Lens Scripting Version 370

Default Value

0.3
@wearableOnly

smoothFollowEnabled

smoothFollowEnabled: boolean

SPECS only

If true, the composition layer will smoothly follow the layer's current pose.

Since

Lens Scripting Version 370

Default Value

false
@wearableOnly

texture

texture: Texture

SPECS only

The texture to display on this composition layer. This must be explicitly set when rendering into the layer to display content.

Since

Lens Scripting Version 370

Default Value

null
@wearableOnly

uniqueIdentifier

readonly uniqueIdentifier: string

Since

Lens Scripting Version 176

Inherited from

Component.uniqueIdentifier

Methods

destroy()

destroy(): void

Destroys the component.

Returns

void

Inherited from

Component.destroy


getSceneObject()

getSceneObject(): SceneObject

Returns the SceneObject the component is attached to.

Returns

SceneObject

Inherited from

Component.getSceneObject


getTransform()

getTransform(): Transform

Returns the Transform this component is attached to.

Returns

Transform

Inherited from

Component.getTransform


getTypeName()

static getTypeName(): TypeName<CompositionLayerComponent>

SPECS only

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<CompositionLayerComponent>

Since

Lens Scripting Version 370

Overrides

Component.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Component.getTypeName


isOfType()

isOfType(type): boolean

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

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Component.isOfType


isSame()

isSame(other): boolean

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

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Component.isSame