Layer

Summary

A layer in the current sketch

Instance Properties

NameReturn TypeDescription

strokes

StrokeList Read-only

All the strokes on this layer

images

ImageList Read-only

All the images on this layer

allowStrokeAnimation

boolean Read/Write

Sets whether or not individual strokes on this layer can be animated via

videos

VideoList Read-only

All the videos on this layer

models

ModelList Read-only

All the models on this layer

guides

GuideList Read-only

All the guides on this layer

cameraPaths

CameraPathList Read-only

All the camera paths on this layer

groups

GroupList Read-only

All the groups on this layer

index

number Read-only

Gets the index of the layer in the layer canvases

active

boolean Read/Write

Is the layer the active layer. Making another layer inactive will make the main layer the active layer again.

transform

Transform Read/Write

The transform of the layer

position

Vector3 Read/Write

The 3D position of the Layer (specifically the position of it's anchor point

rotation

Rotation Read/Write

The rotation of the layer in 3D space

scale

number Read/Write

The scale of the layer

Class Methods

Layer:New()

Creates a new layer

Returns: Layer (The new layer)

Example

myLayer = Layer:New()

Layer:SelectAll()

Selects all strokes and widgets on this layer

Returns: nil

Example

myLayer:SelectAll()

Instance Methods

layer:CenterPivot()

Move the pivot point of the layer to the average center of it's contents

Returns: nil

Example

myLayer:CenterPivot()

layer:ShowPivot()

Shows a visible widget indicating the pivot point of the layer

Returns: nil

Example

myLayer:ShowPivot()

layer:HidePivot()

Hides the visible widget indicating the pivot point of the layer

Returns: nil

Example

myLayer:HidePivot()

layer:Clear()

Deletes all content from the layer

Returns: nil

Example

myLayer:Clear()

layer:Delete()

Deletes the layer and all it's content

Returns: nil

Example

myLayer:Delete()

layer:Squash()

Combines this layer and the one above it. If this layer is the first layer do nothing

Returns: Layer (The layer that contains the combined content)

Example

combinedLayer = myLayer:Squash()

layer:SquashTo(destinationLayer)

Combines this layer with the specified layer

Returns: nil

Parameters:

NameTypeDefaultDescription

destinationLayer

The destination layer

Example

myLayer:SquashTo(otherLayer)

layer:Show()

Shows the layer

Returns: nil

Example

myLayer:Show()

layer:Hide()

Hides the layer

Returns: nil

Example

myLayer:Hide()

layer:SetShaderClipping(clipStart, clipEnd)

Hides the section of the each batch of strokes that is outside the specified range. Affects all strokes on this layer with this brush type

Returns: nil

Parameters:

NameTypeDefaultDescription

clipStart

number

The amount of the stroke to hide from the start (0-1)

clipEnd

number

The amount of the stroke to hide from the end (0-1)

Example

myLayer:SetShaderClipping(0.1, 0.9)

layer:SetShaderClipping(brushType, clipStart, clipEnd)

Hides the section of the each batch of strokes that is outside the specified range. Affects all strokes on this layer with this brush type

Returns: nil

Parameters:

NameTypeDefaultDescription

brushType

string

Only strokes of this brush type will be affected

clipStart

number

The amount of the stroke to hide from the start (0-1)

clipEnd

number

The amount of the stroke to hide from the end (0-1)

Example

myLayer:SetShaderClipping("Ink", 0.1, 0.9)

layer:SetShaderFloat(parameter, value)

Changes a shader float parameter. Affects all strokes on this layer

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

value

number

The new value

Example

myLayer:SetShaderFloat("_EmissionGain", 0.5)

layer:SetShaderFloat(brushType, parameter, value)

Changes a shader float parameter. Affects all strokes on this layer with this brush type

Returns: nil

Parameters:

NameTypeDefaultDescription

brushType

string

Only strokes of this brush type will be affected

parameter

string

The shader parameter name

value

number

The new value

Example

myLayer:SetShaderFloat("Light", "_EmissionGain", 0.5)

layer:SetShaderColor(parameter, color)

Changes a shader color parameter. Affects all strokes on this layer

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

color

The new color

Example

myLayer:SetShaderColor("_TintColor", Color.red)

layer:SetShaderColor(brushType, parameter, color)

Changes a shader color parameter. Affects all strokes on this layer with this brush type

Returns: nil

Parameters:

NameTypeDefaultDescription

brushType

string

Only strokes of this brush type will be affected

parameter

string

The shader parameter name

color

The new color

Example

myLayer:SetShaderColor("Embers", "_TintColor", Color.red)

layer:SetShaderTexture(parameter, image)

Changes a shader texture parameter. Affects all strokes on this layer

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

image

The new image to use as a texture

Example

myLayer:SetShaderTexture("_MainTex", myImage)

layer:SetShaderTexture(brushType, parameter, image)

Changes a shader texture parameter. Affects all strokes on this layer with this brush type

Returns: nil

Parameters:

NameTypeDefaultDescription

brushType

string

Only strokes of this brush type will be affected

parameter

string

The shader parameter name

image

The new image to use as a texture

Example

myLayer:SetShaderTexture("Ink", "_MainTex", myImage)

layer:SetShaderVector(parameter, x, y, z, w)

Changes a shader vector parameter. Affects all strokes on this layer

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

x

number

The new x value

y

number

0

The new y value

z

number

0

The new z value

w

number

0

The new w value

Example

myLayer:SetShaderVector("_TimeOverrideValue", 0.5, 0, 0, 0)

layer:SetShaderVector(brushType, parameter, x, y, z, w)

Changes a shader vector parameter. Affects all strokes on this layer with this brush type

Returns: nil

Parameters:

NameTypeDefaultDescription

brushType

string

Only strokes of this brush type will be affected

parameter

string

The shader parameter name

x

number

The new x value

y

number

0

The new y value

z

number

0

The new z value

w

number

0

The new w value

Example

myLayer:SetShaderVector("NeonPulse", "_TimeOverrideValue", 0.5, 0, 0, 0)

Last updated