Layer script interface

The ILayer script interface represents a layer on a layout.

Layer APIs

name
A read-only string of the layer name.
index
A read-only number with the zero-based index of the layer on its layout. The bottom layer has an index of 0, with the index increasing upwards in Z order.
layout
The ILayout interface representing the layout this layer belongs to.
isVisible
A boolean indicating if the layer is visible or not. When invisible, the layer skips drawing entirely.
opacity
The opacity of the layer, as a floating point number in the range [0, 1], where 0 is fully transparent and 1 is fully opaque. Note that changing the opacity to a value other than 1 will force the layer to render via its own texture.
getViewport()
Return a DOMRect representing the bounds of the viewport on this layer in layout co-ordinates.
effects
An array of IEffectInstance representing the effect parameters of the effects on this layer.
cssPxToLayer(clientX, clientY, z = 0)
layerToCssPx(layerX, layerY, z = 0)
Convert between positions in CSS pixels, such as the clientX/Y properties of an input event, and layer co-ordinates within the project. An optional Z value can be provided to do the conversion taking in to account Z elevation to a certain height on the layer. This is useful for purposes like identifying what position in a layer was clicked in an input event, or positioning a HTML element in layer co-ordinates.
Construct 3 Manual 2020-08-05

On this page