Skip to content

Latest commit

 

History

History
471 lines (194 loc) · 12 KB

File metadata and controls

471 lines (194 loc) · 12 KB

Layer

Summary

A layer in the current sketch

Instance Properties

NameReturn TypeDescription
strokesStrokeList
Read-only
All the strokes on this layer
imagesImageList
Read-only
All the images on this layer
allowStrokeAnimationboolean
Read/Write
Sets whether or not individual strokes on this layer can be animated via
videosVideoList
Read-only
All the videos on this layer
modelsModelList
Read-only
All the models on this layer
guidesGuideList
Read-only
All the guides on this layer
cameraPathsCameraPathList
Read-only
All the camera paths on this layer
groupsGroupList
Read-only
All the groups on this layer
indexnumber
Read-only
Gets the index of the layer in the layer canvases
activeboolean
Read/Write
Is the layer the active layer. Making another layer inactive will make the main layer the active layer again.
transformTransform
Read/Write
The transform of the layer
positionVector3
Read/Write
The 3D position of the Layer (specifically the position of it's anchor point
rotationRotation
Read/Write
The rotation of the layer in 3D space
scalenumber
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
destinationLayerLayerThe 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
clipStartnumberThe amount of the stroke to hide from the start (0-1)
clipEndnumberThe 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
brushTypestringOnly strokes of this brush type will be affected
clipStartnumberThe amount of the stroke to hide from the start (0-1)
clipEndnumberThe 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
parameterstringThe shader parameter name
valuenumberThe 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
brushTypestringOnly strokes of this brush type will be affected
parameterstringThe shader parameter name
valuenumberThe 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
parameterstringThe shader parameter name
colorColorThe 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
brushTypestringOnly strokes of this brush type will be affected
parameterstringThe shader parameter name
colorColorThe 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
parameterstringThe shader parameter name
imageImageThe 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
brushTypestringOnly strokes of this brush type will be affected
parameterstringThe shader parameter name
imageImageThe 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
parameterstringThe shader parameter name
xnumberThe new x value
ynumber0The new y value
znumber0The new z value
wnumber0The 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
brushTypestringOnly strokes of this brush type will be affected
parameterstringThe shader parameter name
xnumberThe new x value
ynumber0The new y value
znumber0The new z value
wnumber0The new w value

Example

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