TweenTransformPath
Tween subclass for path-based animation along waypoints.
| Type | Name | Interface Description |
|---|---|---|
| Variables | delays: number[] | • Function: The array of delays for each path segment in the animation. Only available when |
| Variables | durations: number[] | • Function: The array of durations for each path segment in the animation. Only available when |
| Variables | fixedDuration: boolean | • Function: When |
| Variables | orientation: TweenOrientation | • Function: Orientation mode applied during Position animation. |
| Variables | pathType: TweenPathType | • Function: Path interpolation mode between waypoints. |
| Variables | pointsPathNumber: number[] | • Function: Waypoints for 2D Rotation path animation (used when the target object has a |
| Variables | pointsPathVector2: Vector2f[] | • Function: Waypoints for 2D Position or Scale path animation (used when the target object has a |
| Variables | pointsPathVector3: Vector3f[] | • Function: Waypoints for 3D path animation (used when the target object has a 3D |
| Variables | targetType: TweenTargetType | |
| Functions | constructor() | |
| Functions | pause(): void | • Function: Pauses all active segment tweens and sets the internal paused state. |
| Functions | resume(): void | • Function: Resumes all currently paused segment tweens and clears the internal paused state. |
| Functions | start(): void | • Function: Start tween animation from initial state. If the animation is currently paused, tweens are started and then immediately re-paused. |
| Functions | stop(): void | • Function: Stop the tween animation and keep the current state. |
Examples
constructor()
let obj = new APJS.TweenTransformPath();
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);
}
}