Kiwi.Geom.Transform Class
Represents position, scale, rotation and rotationPoint of an Entity.
- Values can be transformed with a 3x3 affine transformation matrix, which each transform is assigned.
- A tranform can be assigned a parent, which may in turn have it's own parent, thereby creating a tranform inheritence heirarchy
- A concatenated transformation matrix, representing the combined matrices of the transform and its ancestors.
Constructor
Kiwi.Geom.Transform
-
x
-
y
-
scaleX
-
scaleY
-
rotation
-
rotX
-
rotY
Parameters:
-
x
Numberx. X position of the transform.
-
y
Numbery. Y position of the transform.
-
scaleX
NumberscaleX. X scaling of the transform.
-
scaleY
NumberscaleY. Y scaling of the transform.
-
rotation
Numberrotation. Rotation of the transform in radians.
-
rotX
NumberrotX. rotationPoint offset on X axis.
-
rotY
NumberrotY. rotationPoint offset on Y axis.
Returns:
This object.
Item Index
Methods
Methods
checkAncestor
-
transform
Recursively check that a transform does not appear as its own ancestor
Parameters:
-
transform
Kiwi.Geom.TransformThe Transform to check.
Returns:
Returns true if the given transform is the same as this or an ancestor, otherwise false.
clone
-
output
Return a clone of this transform.
Parameters:
-
output
Kiwi.Geom.TransformA Transform to copy the clone in to. If none is given a new Transform object will be made.
Returns:
A clone of this object.
copyFrom
-
transform
Copy another transforms data to this transform. A clone of the source matrix is created for the matrix property.
Parameters:
-
transform
Kiwi.Geom.Transformtransform. The tranform to be copied from.
Returns:
This object.
copyTo
-
destination
Copy this transforms data to the destination Transform. A clone of this transforms matrix is created in the destination Transform Matrix.
Parameters:
-
destination
Kiwi.Geom.TransformThe tranform to copy to.
Returns:
This object.
getCameraY
-
camera
-
camera
Return the x of this transform translated to a camera space
Parameters:
-
camera
Objectthe camera
-
camera
Objectthe camera
Returns:
y coordinate in the camera space
public getCameraY ( camera:Camera ):number
{
var mat = this.getConcatenatedMatrix();
mat.prependMatrix(camera.transform.getConcatenatedMatrix());
return mat.ty;
}
getConcatenatedMatrix
()
Kiwi.Geom.Matrix
public
Return the transformation matrix that concatenates this transform with all ancestor transforms. If there is no parent then this will return a matrix the same as this transforms matrix.
Returns:
The concatenated matrix.
getParentMatrix
()
Kiwi.Geom.Matrix
public
Return the parent matrix of the transform. If there is no parent then null is returned.
Returns:
The parent transform matrix.
getPostionPoint
()
Kiwi.Geom.Point
public
Return a Point representing the X and Y values of the transform. If none is given a new Point objected will be created.
Returns:
A point representing the X and Y values of the transform.
objType
()
String
public
The type of this object.
Returns:
scale
-
value
Set the X and Y scale value of the transform.
Parameters:
-
value
Number
Returns:
This object.
setPosition
-
x
-
y
Set the X and Y values of the transform.
Parameters:
-
x
Numberx.
-
y
Numbery.
Returns:
This object.
setPositionPoint
-
point
Set the X and Y values of the transform from a point.
Parameters:
-
point
Kiwi.Geom.Pointpoint.
Returns:
This object.
setTransform
-
x
-
y
-
scaleX
-
scaleY
-
rotation
-
rotX
-
rotY
Set the core properties of the transform
Parameters:
-
x
Numberx. X position of the transform.
-
y
Numbery. Y position of the transform.
-
scaleX
NumberscaleX. X scaling of the transform.
-
scaleY
NumberscaleY. Y scaling of the transform.
-
rotation
Numberrotation. Rotation of the transform in radians.
-
rotX
NumberrotX. Rotation offset on X axis.
-
rotY
NumberrotY. Rotation offset on Y axis.
Returns:
This object.
toString
()
String
public
Return a string represention of this object.
Returns:
A string represention of this object.
transformPoint
-
point
Apply this matrix to a an object with x and y properties representing a point and return the transformed point.
Parameters:
-
point
Kiwi.Geom.Pointpoint
Returns:
translatePositionFromPoint
-
point
Translate the X and Y value of the transform by point components.
Parameters:
-
point
Kiwi.Geom.Pointpoint.
Returns:
This object.
Properties
_cachedConcatenatedMatrix
Kiwi.Geom.Matrix
private
The most recently calculated matrix from getConcatenatedMatrix.
_matrix
Object
protected
A 3x3 transformation matrix object that can be use this tranform to manipulate points or the context transformation.
_parent
Kiwi.Geom.Transform
private
The parent transform. If set to null there is no parent. Otherwise this is used by getConcatenatedMatrix to offset the current transforms by the another matrix
_rotation
Number
private
Rotation of the transform in radians.
_rotPointX
Number
private
Rotation offset on X axis.
_rotY
Number
private
Rotation offset on Y axis.
_scaleX
Number
private
X scaleof the transform
_scaleY
Number
private
Y scale of the transform
_x
Number
private
X position of the transform
_y
Number
private
Y position of the transform
matrix
Unknown
Return the Matrix being used by this Transform
parent
Unknown
public
Return the parent Transform, if any.
rotation
Unknown
public
Return the rotation value of the transform in radians.
rotPointX
Unknown
public
Return the Rotation value from the x axis.
scaleX
Number
public
Return the X scale value of the transform.
scaleY
Number
public
Return the Y scale value of the transform.
worldX
Unknown
public
Return the x of this transform translated to world space.
worldY
Unknown
public
Return the y of this transform translated to world space.
x
Number
Return the X value of the transform.
y
Number
public
Return the Y value of the transform.