Skip to content

@fibbojs / 2d / FTransform

Class: FTransform ​

2D Transform

Accessors ​

position ​

get position(): object

Get the position.

set position(position): void

Set the position.

Parameters ​

• position

The new position.

• position.x: number

The new position on the x axis.

• position.y: number

The new position on the y axis.

Returns ​

object

x ​

x: number

y ​

y: number

Defined in ​

2d/src/core/FTransform.ts:140


rotation ​

get rotation(): number

Get the rotation in radians.

set rotation(rotation): void

Set the rotation in radians.

Parameters ​

• rotation: number

The new rotation in radians.

Returns ​

number

Defined in ​

2d/src/core/FTransform.ts:187


rotationDegree ​

get rotationDegree(): number

Get the rotation in degrees.

set rotationDegree(rotationDegree): void

Set the rotation in degrees.

Parameters ​

• rotationDegree: number

The new rotation in degrees.

Returns ​

number

Defined in ​

2d/src/core/FTransform.ts:202


scale ​

get scale(): object

Get the scale.

set scale(scale): void

Set the scale.

Parameters ​

• scale

The new scale.

• scale.x: number

The new scale on the x axis.

• scale.y: number

The new scale on the y axis.

Returns ​

object

x ​

x: number

y ​

y: number

Defined in ​

2d/src/core/FTransform.ts:217


scaleX ​

get scaleX(): number

Get the scale on the x axis.

set scaleX(x): void

Set the x scale.

Parameters ​

• x: number

The new scale on the x axis.

Returns ​

number

Defined in ​

2d/src/core/FTransform.ts:234


scaleY ​

get scaleY(): number

Get the scale on the y axis.

set scaleY(y): void

Set the y scale.

Parameters ​

• y: number

The new scale on the y axis.

Returns ​

number

Defined in ​

2d/src/core/FTransform.ts:249


x ​

get x(): number

Get the position on the x axis.

set x(x): void

Set the x position.

Parameters ​

• x: number

The new position on the x axis.

Returns ​

number

Defined in ​

2d/src/core/FTransform.ts:157


y ​

get y(): number

Get the position on the y axis.

set y(y): void

Set the y position.

Parameters ​

• y: number

The new position on the y axis.

Returns ​

number

Defined in ​

2d/src/core/FTransform.ts:172

Constructors ​

new FTransform() ​

new FTransform(options?): FTransform

Create a new FTransform.

Parameters ​

• options?: FTransformOptions

The options for the transform.

Returns ​

FTransform

Example ​

ts
import { FTransform } from '@fibbojs/2d'

const transform = new FTransform({
  position: { x: 0, y: 0 },
  rotation: 0,
  scale: { x: 1, y: 1 },
})

Defined in ​

2d/src/core/FTransform.ts:61

Methods ​

onPositionUpdated() ​

onPositionUpdated(callback): void

Add a callback for when the position is updated.

Parameters ​

• callback

The callback to add.

Returns ​

void

Defined in ​

2d/src/core/FTransform.ts:84


onRotationUpdated() ​

onRotationUpdated(callback): void

Add a callback for when the rotation is updated.

Parameters ​

• callback

The callback to add.

Returns ​

void

Defined in ​

2d/src/core/FTransform.ts:92


onScaleUpdated() ​

onScaleUpdated(callback): void

Add a callback for when the scale is updated.

Parameters ​

• callback

The callback to add.

Returns ​

void

Defined in ​

2d/src/core/FTransform.ts:100


setPosition() ​

setPosition(position): void

Set a new position.

Parameters ​

• position

The new position.

• position.x: number

The new position on the x axis.

• position.y: number

The new position on the y axis.

Returns ​

void

Defined in ​

2d/src/core/FTransform.ts:110


setRotation() ​

setRotation(rotation): void

Set a new rotation in radians.

Parameters ​

• rotation: number

The new rotation in radians.

Returns ​

void

Defined in ​

2d/src/core/FTransform.ts:119


setScale() ​

setScale(scale): void

Set a new scale.

Parameters ​

• scale

The new scale.

• scale.x: number

The new scale on the x axis.

• scale.y: number

The new scale on the y axis.

Returns ​

void

Defined in ​

2d/src/core/FTransform.ts:130

Properties ​

__CALLBACKS_ON_POSITION_UPDATED__ ​

__CALLBACKS_ON_POSITION_UPDATED__: () => void[] = []

Callback for when the position is updated.

Defined in ​

2d/src/core/FTransform.ts:20


__CALLBACKS_ON_ROTATION_UPDATED__ ​

__CALLBACKS_ON_ROTATION_UPDATED__: () => void[] = []

Callback for when the rotation is updated.

Defined in ​

2d/src/core/FTransform.ts:24


__CALLBACKS_ON_SCALE_UPDATED__ ​

__CALLBACKS_ON_SCALE_UPDATED__: () => void[] = []

Callback for when the scale is updated.

Defined in ​

2d/src/core/FTransform.ts:28


__POSITION__ ​

__POSITION__: FVector2

The position of the transform.

Defined in ​

2d/src/core/FTransform.ts:33


__ROTATION__ ​

__ROTATION__: number

The rotation of the transform in radians.

Defined in ​

2d/src/core/FTransform.ts:41


__SCALE__ ​

__SCALE__: FVector2

The scale of the transform.

Defined in ​

2d/src/core/FTransform.ts:37