Skip to main content

Texture

Class

Represents a texture file asset.

  • 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

// Print the texture's height, width
// Change the texture's name and print it out
//@input Asset.Texture texture

print("Width = " + script.texture.getWidth().toString());
print("Height = " + script.texture.getHeight().toString());

// Takes a screenshot of device camera input and applies it to meshVisual
//@input Asset.Texture deviceCameraTexture
//@input Component.MeshVisual meshVisual
var textureCopy = script.deviceCameraTexture.copyFrame();
script.meshVisual.mainPass.baseTex = textureCopy;

Extends

Properties

control

control: TextureProvider

The TextureProvider for the texture, which may control things like animation depending on the texture type. See also: AnimatedTextureFileProvider.

Default Value

null

name

name: string

The name of the Asset in Lens Studio.

Default Value

""

Inherited from

Asset.name


uniqueIdentifier

readonly uniqueIdentifier: string

Since

Lens Scripting Version 176

Inherited from

Asset.uniqueIdentifier

Methods

copyFrame()

copyFrame(): Texture

Returns a Texture that captures the current state of this Texture Asset.

Returns

Texture


createMarkerAsset()

createMarkerAsset(): MarkerAsset

Creates a marker asset from the texture.

Returns

MarkerAsset

Since

Lens Scripting Version 240


getFormat()

getFormat(): TextureFormat

Returns

TextureFormat

Since

Lens Scripting Version 315


getHeight()

getHeight(): number

Returns the height of the texture.

Returns

number


getTypeName()

static getTypeName(): TypeName<Texture>

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

Overrides

Asset.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Asset.getTypeName


getWidth()

getWidth(): number

Returns the width of the texture.

Returns

number


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

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

Asset.isSame