Skip to main content

BackgroundSettings

Class

Settings for rendering the background on a Text component.

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

Settings for rendering the background on a Text component. Accessible through the Text component's backgroundSettings property.

Index

Example

//@input Component.Text textComponent

// Access the background object for a Text component
var bg = script.textComponent.backgroundSettings;

// Enable the background
bg.enabled = true;

// Set the background color
bg.fill.color = new vec4(1, 0, .5, 1);

// Extend the background left and right by 1 unit
bg.margins.left = 1.0;
bg.margins.right = 1.0;

Extends

Properties

cornerRadius

cornerRadius: number

Controls how rounded the corner of the background should be.

Since

Lens Scripting Version 176

Default Value

0

enabled

enabled: boolean

If enabled, the background will be rendered.

Default Value

false

fill

fill: TextFill

Settings for how the inside of the background is drawn.


margins

margins: Rect

Controls how far in each direction the background should extend away from the text.

Methods

getTypeName()

static getTypeName(): TypeName<BackgroundSettings>

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

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