Skip to main content

ScreenTransform

ClassTypeNameInterface Description
ScreenTransform : TransformVariablesanchoredPosition: Vector2f

Anchor position of ScreenTransform

sizeDelta: Vector2f

Size Offset of ScreenTransform

pivot: Vector2f

Rotation point of ScreenTransform

rotation: number

Local rotation angle of ScreenTransform

scale: Vector2f

Local scale of ScreenTransform

anchors: Vector4f

The proportional positions of the four boundaries of the current ScreenTransform relative to its parent ScreenTransform

offsets: Vector4f

Offsets of the 4 sides of the current rectangular area anchors

Examples

anchoredPosition: Vector2f

trans.anchoredPosition = new APJS.Vector2f(0.5, 0.5)

sizeDelta: Vector2f

trans.sizeDelta = new APJS.Vector2f(1, 1)

pivot: Vector2f

transform.pivot = new APJS.Vector2f(0.5, 0.5)

rotation: number

transform.rotation = 45

scale: Vector2f

trans.scale = new APJS.Vector2f(0.5, 0.5)

anchors: Vector4f

trans.anchors = new APJS.Vector4f(0.5, 0.5, 0.5, 0.5)

offsets: Vector4f

trans.offsets = new APJS.Vector4f(0.1, 0.1, 0.1, 0.1)

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {

private transform : APJS.ScreenTransform;
private count : number = 0;
//called before the first frame update
onStart() {
this.transform = this.getSceneObject().getComponent("ScreenTransform") as APJS.ScreenTransform;

}

//called once per frame
onUpdate(deltaTime: number) {
const position = this.transform.anchoredPosition;
this.transform.anchoredPosition = new APJS.Vector2f(position.x + 0.5, position.y + 0.5);
const sizeDelta = this.transform.sizeDelta;
this.transform.sizeDelta = new APJS.Vector2f(sizeDelta.x + 1, sizeDelta.y + 1);
const povit = this.transform.pivot;
this.transform.pivot = new APJS.Vector2f(povit.x + 0.001, povit.y + 0.001);
const rotation = this.transform.rotation;
this.transform.rotation = rotation + 10;
const scale = this.transform.scale;
this.transform.scale = new APJS.Vector2f(scale.x + 0.01, scale.y + 0.01);
}

//inherted more for your logic
}
Copyright © 2025 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalCookies