Stroke

Summary

A specific brush stroke

Instance Properties

NameReturn TypeDescription

path

Path Read/Write

The control points of this stroke from a Path

brushType

string Read/Write

The stroke's brush type

brushSize

number Read/Write

The stroke's size

brushColor

Color Read/Write

The stroke's Color

layer

Layer Read/Write

The layer the stroke is on

group

Group Read/Write

The group this stroke is part of

this[index]

Transform Read/Write

Gets or sets a control point by index

count

number Read-only

The number of control points in this stroke

Class Methods

Stroke:SelectRange(from, to)

Adds multiple strokes to the current selection

Returns: nil

Parameters:

NameTypeDefaultDescription

from

number

Start stroke index (0 is the first stroke that was drawn

to

number

End stroke index

Example

Stroke:SelectMultiple(0, 4) --Adds the first 5 strokes on the sketch

Instance Methods

stroke:ChangeMaterial(brushName)

Assigns the material from another brush type to this stroke (Experimental. Results are unpredictable and are not saved with the scene)

Returns: nil

Parameters:

NameTypeDefaultDescription

brushName

string

The name (or guid) of the brush to get the material from

Example

myStroke.ChangeMaterial("Light")

stroke:Delete()

Deletes the current stroke

Returns: nil

Example

myStroke:Delete()

stroke:Select()

Adds this stroke to the current selection

Returns: nil

Example

myStroke:Select()

stroke:Deselect()

Removes this stroke from the current selection

Returns: nil

Example

myStroke:Deselect()

stroke:JoinRange(from, to)

Joins joins multiple strokes into one stroke

Returns: Stroke

Parameters:

NameTypeDefaultDescription

from

number

Start stroke index (0 is the first stroke that was drawn

to

number

End stroke index

Example

newStroke = Stroke:Join(0, 10)

stroke:JoinToPrevious()

Joins a stroke with the previous stroke

Returns: Stroke

Example

newStroke = myStroke:JoinPrevious()

stroke:Join(stroke2)

Joins a stroke with the previous stroke

Returns: Stroke

Parameters:

NameTypeDefaultDescription

stroke2

The stroke to join to this one

Example

newStroke = myStroke:JoinPrevious()

stroke:MergeFrom(name)

Imports the file with the specified name from the user's Sketches folder and merges it's strokes into the current sketch

Returns: nil

Parameters:

NameTypeDefaultDescription

name

string

Name of the file to be merged

Example

Stroke:MergeFrom(string name)

stroke:SetShaderClipping(clipStart, clipEnd)

Hides the section of the stroke that is outside the specified range

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

myStroke:SetShaderClipping(0.1, 0.9)

stroke:SetShaderFloat(parameter, value)

Changes a shader float parameter

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

value

number

The new value

Example

myStroke:SetShaderFloat("_EmissionGain", 0.5)

stroke:SetShaderColor(parameter, color)

Changes a shader color parameter

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

color

The new color

Example

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

stroke:SetShaderTexture(parameter, image)

Changes a shader texture parameter

Returns: nil

Parameters:

NameTypeDefaultDescription

parameter

string

The shader parameter name

image

The new image to use as a texture

Example

myStroke:SetShaderTexture("_MainTex", myImage)

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

Changes a shader vector parameter

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

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

Last updated