Class: Transform2d

SQR. Transform2d

Constructor

new Transform2d()

Similar to {SQR.Transform} but specialized to work with 2d rendeirng on a 2d canvas element.
Source:

Members

position :SQR.V3

the position of this transform relative to it's parent. It's a 3d vector, because z is used for depth indexing.
Type:
Source:

rotation :SQR.V3

the rotation of the transform in radians
Type:
Source:

scale :SQR.V2

the scale of the object on x and y axis
Type:
Source:

Methods

add()

Add a child transform. Accepts multiple arguments but all of them need to be of type {SQR.Transform2D}. It doesn't do any sort of type checking so if you add non object that are not {SQR.Transform2D} it will result in errors when the scene is rendered.
Source:

contains(c)

Checks if transform is child of this transfom
Parameters:
Name Type Description
c SQR.Transform2D the transform to look for
Source:

recurse(f, excludeSelf)

Execute this function on all the child transforms including this current one.
Parameters:
Name Type Description
f function the function that will be called on each child. This function will receive the transform as argument.
excludeSelf boolean if set to true, the function will only be called for all the ancestors of the Transform.
Source:

remove()

Removes a child transform. Accepts multiple arguments but all of them need to be of type {SQR.Transform2D}
Source:

removeAll()

Removes all children transform.
Source: