Skip to main content

VectorStroke

Class

An immutable stroke style — width, line cap, line join, miter limit, and an optional dash pattern.

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

Platform details

  • Snapchat — Not supported — Available on SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — Available on SPECS only.

  • Camera Kit Mobile — Not supported — Available on SPECS only.

Since Lens Scripting v370

An immutable stroke style — width, line cap, line join, miter limit, and an optional dash pattern. Produced by VectorStrokeBuilder#build and never mutated after. A stroke carries only style (no path geometry), so it is freely shareable: pass the same VectorStroke to multiple VectorCompositeBuilder#addStroke calls to stroke several paths with one style. Exposes read-only metadata — VectorStroke#width, VectorStroke#cap, VectorStroke#join, VectorStroke#miterLimit, and VectorStroke#dashed.

Index

Example

var sb = VectorStrokeBuilder.create(6);
sb.setCap(VectorComposite.LineCap.Round);
sb.setJoin(VectorComposite.LineJoin.Round);
sb.setDash([24, 12], 0);
var stroke = sb.build();
print(stroke.width); // 6
print(stroke.dashed); // true

Extends

Properties

cap

readonly cap: LineCap

SPECS

The VectorComposite.LineCap — how the ends of open sub-paths and dash segments are rendered.

Since

Lens Scripting Version 370


dashed

readonly dashed: boolean

SPECS

Whether this stroke is dashed — true when an explicit dash pattern is set, false for a continuous line (the default).

Since

Lens Scripting Version 370


join

readonly join: LineJoin

SPECS

The VectorComposite.LineJoin — how corners between connected path segments are rendered.

Since

Lens Scripting Version 370


miterLimit

readonly miterLimit: number

SPECS

The miter limit — controls when a Miter join falls back to a bevel. Always greater than or equal to 1.

Since

Lens Scripting Version 370


width

readonly width: number

SPECS

The stroke width in the composite's coordinate space. Always greater than 0.

Since

Lens Scripting Version 370

Methods

getTypeName()

static getTypeName(): TypeName<VectorStroke>

SPECS

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<VectorStroke>

Since

Lens Scripting Version 370

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.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

ScriptObject.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

ScriptObject.isSame