Skip to main content

TweenTransform

Tween subclass for transform animations (position, rotation, scale).

TypeNameInterface Description
VariablesendNumber: number

Function: End number (2D Rotation).

VariablesendVector2: Vector2f

Function: End Vector2 (2D Position/Scale).

VariablesendVector3: Vector3f

Function: End Vector3 (3D, all targets). Used in FromTo and To modes.

VariablesoffsetNumber: number

Function: Offset number (2D Rotation). Only used when motionType=Offset.

VariablesoffsetVector2: Vector2f

Function: Offset Vector2 (2D Position/Scale). Only used when motionType=Offset.

VariablesoffsetVector3: Vector3f

Function: Offset Vector3 (3D). Only used when motionType=Offset.

VariablesstartNumber: number

Function: Start number (2D Rotation). Only used when motionType=FromTo.

VariablesstartVector2: Vector2f

Function: Start Vector2 (2D Position/Scale). Only used when motionType=FromTo.

VariablesstartVector3: Vector3f

Function: Start Vector3 (3D, all targets). Only used when motionType=FromTo.

VariablestargetType: TweenTargetType

Functionsconstructor()

Functionspause(): void

Function: Pause tween animation.

Functionsresume(): void

Function: Resume tween animation.

Functionsstart(): void

Function: Start tween animation from initial state.

Functionsstop(): void

Function: Stop the tween animation and keep the current state.

Examples

constructor()

let obj = new APJS.TweenTransform();

Use Case

Scale bounce animation on tap — object pops up to 1.5x then settles back using Tween component with PingPongOnce

@component()
export class TweenScaleBounce extends APJS.BasicScriptComponent {
private tween!: APJS.Tween;
private touchCallback!: (event: APJS.IEvent) => void;

onStart(): void {
this.tween = this.getSceneObject().getComponent("Tween") as APJS.Tween;

this.touchCallback = (event: APJS.IEvent) => {
const touch = event.args[0] as APJS.TouchData;
if (touch.phase === APJS.TouchPhase.Began) {
this.playBounce();
}
};
APJS.EventManager.getGlobalEmitter().on(APJS.EventType.Touch, this.touchCallback, this);
}

private playBounce(): void {
if (!this.tween) return;
// Default tweenType is TransformPath — use TweenTransformPath API
const anim = this.tween.tweenAnimation as APJS.TweenTransformPath;
anim.targetType = APJS.TweenTargetType.Scale;
anim.pointsPathVector3 = [
new APJS.Vector3f(1, 1, 1),
new APJS.Vector3f(1.5, 1.5, 1.5),
];
anim.durations = [0.4];
anim.fixedDuration = true;
anim.pathType = APJS.TweenPathType.Straight;
anim.easingFunction = APJS.TweenEasingFunction.Back;
anim.easingType = APJS.TweenEasingType.Out;
anim.playMode = APJS.TweenPlayMode.PingPongOnce;
anim.start();
}

onDestroy(): void {
APJS.EventManager.getGlobalEmitter().off(APJS.EventType.Touch, this.touchCallback, this);
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies