Class Transform

Hierarchy

  • Transform

Constructors

  • Constructs new Transform

    Parameters

    • posX: number

      The X-coordinate

    • posY: number

      The Y-coordinate

    • scaleX: number

      The width

    • scaleY: number

      The height

    • rotation: number = 0

      The rotation in degrees

    Returns Transform

Properties

position: Vector2

Position

rotation: Rotation

Rotation

scale: Vector2

Width and height

Accessors

  • get angles(): number
  • Gets rotation in radians.

    Returns number

  • set angles(radians: number): void
  • Sets rotation in radians.

    Parameters

    • radians: number

    Returns void

  • get eulerAngles(): number
  • Gets rotation in degrees.

    Property

    Returns number

  • set eulerAngles(degrees: number): void
  • Sets rotation in degrees.

    Parameters

    • degrees: number

    Returns void

Methods

  • Repositions X-coordinate and Y-coordinate.

    Method

    Example

    const vector2 = new JSGL.Vector2(5, 2);
    transform.translate(vector2);

    transform.translate(5, 2);

    Parameters

    • x: number | Vector2

      Vector2 or X-coordinate

    • Optional y: number

      Optional Y-coordinate

    Returns void

  • Repositions X-coordinate.

    Method

    Example

    const vector2 = new JSGL.Vector2(5, 2);
    transform.translateX(vector2);

    transform.translateX(5);

    Parameters

    • x: number | Vector2

      Vector2 or X-coordinate

    Returns void

  • Repositions Y-coordinate.

    Method

    Example

    const vector2 = new JSGL.Vector2(5, 2);
    transform.translateY(vector2);

    transform.translateY(2);

    Parameters

    • y: number | Vector2

      Vector2 or Y-coordinate

    Returns void