Skip to main content

VisualEffectAsset

Represents a VFX profile resource.

TypeNameInterface Description
Functionsconstructor()

FunctionsgetBool(name: string): boolean | undefined

Function: Gets a named boolean value from VFX Profile. The key must match an exposed boolean property name from the VFX profile.

Parameters

name: - The name of the boolean property.

Returns The value of the boolean property or undefined.

FunctionsgetColor(name: string): Color | null

Function: Gets a named color value from VFX Profile. Color keys are exposed color properties stored in the profile's vec4-backed property map and must match exactly.

Parameters

name: - The name of the color property.

Returns The value of the color property, or null when no matching exposed color key exists.

FunctionsgetFloat(name: string): number | undefined

Function: Gets a named float value from VFX Profile.

Parameters

name: - The name of the float property.

Returns The value of the float property or undefined.

FunctionsgetInt(name: string): number | undefined

Function: Gets a named integer value from VFX Profile. The key can be either an exposed integer property name or a supported derived spawn key such as burstcount_<index>, spawnratemin_<index>, or spawnratemax_<index>.

Parameters

name: - The name of the integer property.

Returns The value of the integer property or undefined.

FunctionsgetTexture(name: string): Texture | null

Function: Gets a named texture value from VFX Profile. Texture keys must match exposed texture property names from the VFX graph/profile exactly.

Parameters

name: - The name of the texture property.

Returns The value of the texture property, or null when no matching exposed texture key exists or no texture is currently assigned.

FunctionsgetVector(name: string): Vector2f | Vector3f | Vector4f | null

Function: Gets a named vector value from VFX Profile. Vector keys must match exposed vector property names from the VFX graph/profile exactly. Returns Vector2f for vec2 keys. For vec4-backed keys whose name starts with Vector3f_, this method trims the stored vec4 value to a Vector3f; other vec4-backed keys return Vector4f.

Parameters

name: - The name of the vector property.

Returns The value of the vector property or null.

FunctionshasBoolKey(name: string): boolean

Function: Checks if the VFX profile has a boolean key. The key must match an exposed boolean property name from the VFX profile.

Parameters

name: - The name to check for in the boolean map.

Returns A boolean indicating whether the property exists in the VFX Profile.

FunctionshasColorKey(name: string): boolean

Function: Checks if the VFX profile has a color key. Color keys are exposed color properties stored in the profile's vec4-backed property map and must match exactly.

Parameters

name: - The color key to check.

Returns A boolean indicating whether the property exists in the VFX Profile.

FunctionshasFloatKey(name: string): boolean

Function: Checks if the VFX profile has a float key. The key can be either an exposed float property name or a supported derived spawn key. <index> is the zero-based position in (i.e. contextBlocks[<index>]). Derived spawn keys are only meaningful when contextBlocks[<index>] is a Spawner context, because the Spawn Rate block (which owns these properties) can only be placed in a Spawner context. Supported derived spawn keys: - spawnrate_<index> - number of particles spawned per second by the Spawn Rate block of contextBlocks[<index>] - burstdelay_<index> - delay in seconds the Spawn Rate block of contextBlocks[<index>] waits before each Periodic Burst. Returns true whenever contextBlocks[<index>] exists, regardless of its context type. Note: for this key returns undefined when delayMin and delayMax differ by more than 0.0003. - delaymin_<index> - minimum delay in seconds the Spawn Rate block of contextBlocks[<index>] waits before each burst (Random mode) - delaymax_<index> - maximum delay in seconds the Spawn Rate block of contextBlocks[<index>] waits before each burst (Random mode)

Parameters

name: - The key to check for in the float map.

Returns A boolean indicating whether the property exists in the VFX Profile.

FunctionshasIntKey(name: string): boolean

Function: Checks if the VFX profile has an integer key. The key can be either an exposed integer property name or a supported derived spawn key such as burstcount_<index>, spawnratemin_<index>, or spawnratemax_<index>.

Parameters

name: - The key to check for in the integer map.

Returns A boolean indicating whether the key exists in the VFX Profile.

FunctionshasTextureKey(name: string): boolean

Function: Checks if the VFX profile has a texture key. Texture keys must match exposed texture property names from the VFX graph/profile exactly. If multiple context blocks expose the same key, this method returns true when any matching block contains it.

Parameters

name: - The texture key to check.

Returns A boolean indicating whether the property exists in the VFX Profile.

FunctionshasVectorKey(name: string): boolean

Function: Checks if the VFX profile has a vector key. Vector keys must match exposed vector property names from the VFX graph/profile exactly. This method checks vec2, vec3, and vec4-backed exposed properties.

Parameters

name: - The vector key to check.

Returns A boolean indicating whether the property exists in the VFX Profile.

FunctionssetBool(name: string, value: boolean): void

Function: Sets a named boolean value on the VFX Profile. The key must match an exposed boolean property name from the VFX profile.

Parameters

name: - The name of the boolean property.

value: - The boolean value to set.

FunctionssetColor(name: string, value: Color): void

Function: Sets a named color value to VFX Profile. Color keys are exposed color properties stored in the profile's vec4-backed property map and must match exactly. If multiple context blocks expose the same key, this method updates every matching block.

Parameters

name: - The name of the color property.

value: - The color value to set.

FunctionssetFloat(name: string, value: number): void

Function: Sets a named float value to VFX Profile.

Parameters

name: - The name of the float property.

value: - The float value to set.

FunctionssetInt(name: string, value: number): void

Function: Sets a named integer value to VFX Profile. The key can be either an exposed integer property name or a supported derived spawn key such as burstcount_<index>, spawnratemin_<index>, or spawnratemax_<index>.

Parameters

name: - The name of the integer property.

value: - The integer value to set.

FunctionssetTexture(name: string, value: Texture): void

Function: Sets a named texture value to VFX Profile. Texture keys must match exposed texture property names from the VFX graph/profile exactly. If multiple context blocks expose the same key, this method updates every matching block.

Parameters

name: - The name of the texture property.

value: - The texture value to set.

FunctionssetVector(name: string, value: Vector2f | Vector3f | Vector4f): void

Function: Sets a named vector value to VFX Profile. Vector keys must match exposed vector property names from the VFX graph/profile exactly. For vec2-backed keys, pass Vector2f. For vec4-backed keys, pass Vector4f, or pass Vector3f only for keys that use the Vector3f_ naming convention and are stored internally as vec4. If multiple context blocks expose the same key, this method updates every matching block.

Parameters

name: - The name of the vector property.

value: - The vector value to set.

Examples

constructor()

let obj = new APJS.VisualEffectAsset();

setBool(name: string, value: boolean): void

export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set specific property to true
const asset = this.visualEffectComponent.asset;
if (asset.hasBoolKey('Bool_0_0') && !asset.getBool('Bool_0_0')) {
asset.setBool('Bool_0_0', true);
}
}
}
}

setColor(name: string, value: Color): void

export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set Color to red
const asset = this.visualEffectComponent.asset;
const red = new APJS.Color(1.0, 0, 0, 1.0);
const current = asset.getColor('Color_0_0');
if (asset.hasColorKey('Color_0_0') && current && !current.equals(red)) {
asset.setColor('Color_0_0', red);
}
}
}
}

setFloat(name: string, value: number): void

export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set specific property to 100.0
const asset = this.visualEffectComponent.asset;
if (asset.hasFloatKey('Float_0_0') && asset.getFloat('Float_0_0') < 100.0) {
asset.setFloat('Float_0_0', 100.0);
}
}
}
}

setInt(name: string, value: number): void

export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set specific property to 10
const asset = this.visualEffectComponent.asset;
if (asset.hasIntKey('Int_0_0') && asset.getInt('Int_0_0') !== 10) {
asset.setInt('Int_0_0', 10);
}
}
}
}

setTexture(name: string, value: Texture): void

export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
.....
if (conditions) {
// Set Texture to newTexture
const asset = this.visualEffectComponent.asset;
if (asset.hasTextureKey('Texture_0_0') && !asset.getTexture('Texture_0_0')) {
asset.setTexture('Texture_0_0', newTexture);
}
}
}
}

setVector(name: string, value: Vector2f | Vector3f | Vector4f): void

export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set Vector3f to (1.0, 0, 0)
const asset = this.visualEffectComponent.asset;
const value = new APJS.Vector3f(1.0, 0, 0);
const current = asset.getVector('Vector3f_0_0');
if (asset.hasVectorKey('Vector3f_0_0') && current && !current.equals(value)) {
asset.setVector('Vector3f_0_0', value);
}
}
}
}

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use VisualEffectAsset here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies