Options
Menu

Class Transform

The Transform class provides access to color adjustment properties and two- or three-dimensional transformation objects that can be applied to a display object. During the transformation, the color or the orientation and position of a display object is adjusted(offset) from the current values or coordinates to new values or coordinates. The Transform class also collects data about color and two-dimensional matrix transformations that are applied to a display object and all of its parent objects. You can access these combined transformations through the concatenatedColorTransform and concatenatedMatrix properties.

To apply color transformations: create a ColorTransform object, set the color adjustments using the object's methods and properties, and then assign the colorTransformation property of the transform property of the display object to the new ColorTransformation object.

To apply two-dimensional transformations: create a Matrix object, set the matrix's two-dimensional transformation, and then assign the transform.matrix property of the display object to the new Matrix object.

To apply three-dimensional transformations: start with a three-dimensional display object. A three-dimensional display object has a z property value other than zero. You do not need to create the Matrix3D object. For all three-dimensional objects, a Matrix3D object is created automatically when you assign a z value to a display object. You can access the display object's Matrix3D object through the display object's transform property. Using the methods of the Matrix3D class, you can add to or modify the existing transformation settings. Also, you can create a custom Matrix3D object, set the custom Matrix3D object's transformation elements, and then assign the new Matrix3D object to the display object using the transform.matrix property.

To modify a perspective projection of the stage or root object: use the transform.matrix property of the root display object to gain access to the PerspectiveProjection object. Or, apply different perspective projection properties to a display object by setting the perspective projection properties of the display object's parent. The child display object inherits the new properties. Specifically, create a PerspectiveProjection object and set its properties, then assign the PerspectiveProjection object to the perspectiveProjection property of the parent display object's transform property. The specified projection transformation then applies to all the display object's three-dimensional children.

Since both PerspectiveProjection and Matrix3D objects perform perspective transformations, do not assign both to a display object at the same time. Use the PerspectiveProjection object for focal length and projection center changes. For more control over the perspective transformation, create a perspective projection Matrix3D object.

Hierarchy

Index

Constructors

constructor

Properties

matrix

matrix: Matrix

A Matrix object containing values that alter the scaling, rotation, and translation of the display object.

If the matrix property is set to a value(not null), the matrix3D property is null. And if the matrix3D property is set to a value(not null), the matrix property is null.

throws

TypeError The matrix is null when being set

Accessors

backVector

  • Returns Vector3D

colorTransform

  • A ColorTransform object containing values that universally adjust the colors in the display object.

    throws

    TypeError The colorTransform is null when being set

    Returns ColorTransform

  • A ColorTransform object containing values that universally adjust the colors in the display object.

    Parameters

    Returns void

concatenatedMatrix3D

  • A Matrix object representing the combined transformation matrixes of the display object and all of its parent objects, back to the root level. If different transformation matrixes have been applied at different levels, all of those matrixes are concatenated into one matrix for this property. Also, for resizeable SWF content running in the browser, this property factors in the difference between stage coordinates and window coordinates due to window resizing. Thus, the property converts local coordinates to window coordinates, which may not be the same coordinate space as that of the Scene.

    Returns Matrix3D

downVector

  • Returns Vector3D

forwardVector

  • Returns Vector3D

inverseConcatenatedMatrix3D

  • Returns Matrix3D

leftVector

  • Returns Vector3D

matrix3D

  • Provides access to the Matrix3D object of a three-dimensional display object. The Matrix3D object represents a transformation matrix that determines the display object's position and orientation. A Matrix3D object can also perform perspective projection.

    If the matrix property is set to a value(not null), the matrix3D property is null. And if the matrix3D property is set to a value(not null), the matrix property is null.

    Returns Matrix3D

  • Provides access to the Matrix3D object of a three-dimensional display object. The Matrix3D object represents a transformation matrix that determines the display object's position and orientation. A Matrix3D object can also perform perspective projection.

    If the matrix property is set to a value(not null), the matrix3D property is null. And if the matrix3D property is set to a value(not null), the matrix property is null.

    Parameters

    Returns void

pixelBounds

  • A Rectangle object that defines the bounding rectangle of the display object on the stage.

    Returns Rectangle

position

  • Defines the position of the 3d object, relative to the local coordinates of the parent ObjectContainer3D.

    Returns Vector3D

rightVector

  • Returns Vector3D

rotation

  • Defines the rotation of the 3d object, relative to the local coordinates of the parent ObjectContainer3D.

    Returns Vector3D

scale

  • Defines the scale of the 3d object, relative to the local coordinates of the parent ObjectContainer3D.

    Returns Vector3D

skew

  • Defines the scale of the 3d object, relative to the local coordinates of the parent ObjectContainer3D.

    Returns Vector3D

upVector

  • Returns Vector3D

Methods

addEventListener

  • addEventListener(type: string, listener: function): void
  • Add an event listener

    method

    addEventListener

    Parameters

    • type: string
    • listener: function

    Returns void

append

  • Parameters

    Returns void

clearColorTransform

  • clearColorTransform(): void
  • Returns void

clearMatrix3D

  • clearMatrix3D(): void
  • Returns void

clone

  • Returns Transform

copyRawDataTo

  • Parameters

    Returns void

dispatchEvent

dispose

  • dispose(): void
  • Returns void

hasEventListener

  • hasEventListener(type: string, listener?: function): boolean
  • check if an object has an event listener assigned to it

    method

    hasListener

    Parameters

    • type: string
    • Optional listener: function

    Returns boolean

invalidateColorTransform

  • invalidateColorTransform(): void
  • Returns void

invalidateComponents

  • invalidateComponents(): void
  • Returns void

invalidateConcatenatedMatrix3D

  • invalidateConcatenatedMatrix3D(): void
  • Returns void

Private invalidateMatrix3D

  • invalidateMatrix3D(): void
  • Invalidates the 3D transformation matrix, causing it to be updated upon the next request

    Returns void

invalidatePosition

  • invalidatePosition(): void
  • Returns void

moveBackward

  • moveBackward(distance: number): void
  • Moves the 3d object backwards along it's local z axis

    Parameters

    • distance: number

      The length of the movement

    Returns void

moveDown

  • moveDown(distance: number): void
  • Moves the 3d object backwards along it's local y axis

    Parameters

    • distance: number

      The length of the movement

    Returns void

moveForward

  • moveForward(distance: number): void
  • Moves the 3d object forwards along it's local z axis

    Parameters

    • distance: number

      The length of the movement

    Returns void

moveLeft

  • moveLeft(distance: number): void
  • Moves the 3d object backwards along it's local x axis

    Parameters

    • distance: number

      The length of the movement

    Returns void

moveRight

  • moveRight(distance: number): void
  • Moves the 3d object forwards along it's local x axis

    Parameters

    • distance: number

      The length of the movement

    Returns void

moveTo

  • moveTo(dx: number, dy: number, dz: number): void
  • Moves the 3d object directly to a point in space

    Parameters

    • dx: number

      The amount of movement along the local x axis.

    • dy: number

      The amount of movement along the local y axis.

    • dz: number

      The amount of movement along the local z axis.

    Returns void

moveUp

  • moveUp(distance: number): void
  • Moves the 3d object forwards along it's local y axis

    Parameters

    • distance: number

      The length of the movement

    Returns void

pitch

  • pitch(angle: number): void
  • Rotates the 3d object around it's local x-axis

    Parameters

    • angle: number

      The amount of rotation in degrees

    Returns void

removeEventListener

  • removeEventListener(type: string, listener: function): void
  • Remove an event listener

    method

    removeEventListener

    Parameters

    • type: string
    • listener: function

    Returns void

roll

  • roll(angle: number): void
  • Rotates the 3d object around it's local z-axis

    Parameters

    • angle: number

      The amount of rotation in degrees

    Returns void

rotate

  • rotate(axis: Vector3D, angle: number): void
  • Rotates the 3d object around an axis by a defined angle

    Parameters

    • axis: Vector3D

      The vector defining the axis of rotation

    • angle: number

      The amount of rotation in degrees

    Returns void

rotateTo

  • rotateTo(ax: number, ay: number, az: number): void
  • Rotates the 3d object directly to a euler angle

    Parameters

    • ax: number

      The angle in degrees of the rotation around the x axis.

    • ay: number

      The angle in degrees of the rotation around the y axis.

    • az: number

      The angle in degrees of the rotation around the z axis.

    Returns void

scaleTo

  • scaleTo(sx: number, sy: number, sz: number): void
  • Parameters

    • sx: number
    • sy: number
    • sz: number

    Returns void

skewTo

  • skewTo(sx: number, sy: number, sz: number): void
  • Parameters

    • sx: number
    • sy: number
    • sz: number

    Returns void

translate

  • translate(axis: Vector3D, distance: number): void
  • Moves the 3d object along a vector by a defined length

    Parameters

    • axis: Vector3D

      The vector defining the axis of movement

    • distance: number

      The length of the movement

    Returns void

translateLocal

  • translateLocal(axis: Vector3D, distance: number): void
  • Moves the 3d object along a vector by a defined length

    Parameters

    • axis: Vector3D

      The vector defining the axis of movement

    • distance: number

      The length of the movement

    Returns void

updateMatrix3D

  • updateMatrix3D(): void
  • Returns void

yaw

  • yaw(angle: number): void
  • Rotates the 3d object around it's local y-axis

    Parameters

    • angle: number

      The amount of rotation in degrees

    Returns void

Generated using TypeDoc