import { Mat3, Vec2 } from '../../math'; import { Component } from '../component'; /** * Built-in Transform2D Component, defining the position, scale, rotation and velocity of a two dimensional Entity * * Provides for both relative movement along own axes as well as absolute movement along the world axes * * Produces the Mat3 Transformation Matrix used in shaders to position Game Objects */ export declare class Transform2D extends Component { readonly initialPosition: Vec2; readonly initialScale: Vec2; readonly initialAngle: number; readonly velocity: Vec2; /** Maintained position */ readonly position: Vec2; /** Maintained 'up' Axis */ readonly up: Vec2; /** Maintained 'right' Axis */ readonly right: Vec2; /** Maintained scale factor */ readonly scale: Vec2; /** Maintained rotation angle (radians) */ readonly angle: number; /** * Constructor. Take and store the initial position, scale, angle and velocity * * @param initialPosition the position of the Entity, expressed as a Vec2. Defaults to 0,0 * @param initialScale the starting scale of the Entity, expressed as a Vec2. Defaults to 1,1 * @param initialAngle the starting rotation of the Entity. Defaults to 0 * @param velocity the velocity of the Entity, expressed as a Vec2. Defaults to 0,0 */ constructor(initialPosition?: Vec2, initialScale?: Vec2, initialAngle?: number, velocity?: Vec2); /** * Move along the right axis by a given amount * * Facilitates relative movement * * @param amount the amount to move by */ moveRight(amount: number): void; /** * Move along the up axis by a given amount * * Facilitates relative movement * * @param the amount to move by */ moveUp(amount: number): void; /** * Convenience wrapper for moveRight() and moveUp(), taking a Vec2 to represent the Right and Up amounts * * @param amounts the Right and Up amounts to move by */ move(amounts: Vec2): void; /** * Move along the World axes by a given translation vector * * @param translate the translation vector */ translate(translate: Vec2): void; /** * Rotate by a given angle (radians) * * @param angle the angle (radians) to rotate by */ rotate(angle: number): void; /** * Scale the Transform2D by a given factor, relative to its current scale * * @param factor the Vec2 to scale by */ scaleBy(factor: Vec2): void; /** * Scale the Transform2D to a given absolute factor * * @param factor the Vec2 scale factor to adopt */ scaleTo(factor: Vec2): void; /** * Reset all transformations back to their initial values, including the Transform's axes */ reset(): void; /** * Compute the composite Transform Matrix from the maintained translation, scaling and rotation * * @returns the Transform matrix */ compute(): Mat3; /** * Getter for a Mutable cast of the Transform2D instance; used for enabling internal-only mutation of translation, rotation and scale * * @returns the typecasted Mutable Transform2D instance */ private get mutable(); }