Skip to main content

TransformerBuilder

Class

Builds Transformer objects for MLComponent.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Index

Example

var transformer = MachineLearning.createTransformerBuilder()
.setVerticalAlignment(VerticalAlignment.Center)
.setHorizontalAlignment(HorizontalAlignment.Center)
.setRotation(TransformerRotation.Rotate180)
.setFillColor(new vec4(0, 0, 0, 1))
.build();

var outputBuilder = MachineLearning.createOutputBuilder();
outputBuilder.setName("probs");
outputBuilder.setShape(new vec3(1, 1, 200));
outputBuilder.setOutputMode(MachineLearning.OutputMode.Data);
outputBuilder.setTransformer(transformer);
var outputPlaceholder = outputBuilder.build();

Extends

Methods

build()

build(): Transformer

Builds and returns a Transformer object based on the current settings.

Returns

Transformer

Since

Lens Scripting Version 145


getTypeName()

static getTypeName(): TypeName<TransformerBuilder>

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

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


setFillColor()

setFillColor(color): TransformerBuilder

Sets the fill value used.

Parameters

ParameterType
colorvec4

Returns

TransformerBuilder


setFlipX()

setFlipX(value): TransformerBuilder

Enables or disables horizontal flipping.

Parameters

ParameterType
valueboolean

Returns

TransformerBuilder


setFlipY()

setFlipY(value): TransformerBuilder

Enables or disables vertical flipping.

Parameters

ParameterType
valueboolean

Returns

TransformerBuilder


setHorizontalAlignment()

setHorizontalAlignment(mode): TransformerBuilder

Sets the horizontal alignment type used.

Parameters

ParameterType
modeHorizontalAlignment

Returns

TransformerBuilder


setRotation()

setRotation(mode): TransformerBuilder

Sets the rotation type used.

Parameters

ParameterType
modeTransformerRotation

Returns

TransformerBuilder


setStretch()

setStretch(value): TransformerBuilder

Sets the stretching type used.

Parameters

ParameterType
valueboolean

Returns

TransformerBuilder


setVerticalAlignment()

setVerticalAlignment(mode): TransformerBuilder

Sets the vertical alignment type used.

Parameters

ParameterType
modeVerticalAlignment

Returns

TransformerBuilder