Class Index | File Index

Classes


Class R.components.Transform2D


Extends R.components.Base.
A simple component that maintains position, rotation, and scale.
Defined in: transform2d.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
R.components.Transform2D(name, priority)
Create a 2d transformation component
Fields borrowed from class R.components.Base:
TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Summary
Method Attributes Method Name and Description
 
Destroy the component instance
 
execute(renderContext, time, dt)
Set the components of a transformation: position, rotation, and scale, within the rendering context.
 
Get the class name of this object
 
Get the last position of the transformation relative to the world.
 
Get the last position of the transformation relative to the viewport.
 
Returns the position of the transformation relative to the world.
 
Returns the position of the transformation relative to the viewport.
 
Get the rotation of the transformation relative to the viewport.
 
Get the uniform scale of the transformation relative to the viewport.
 
Get the uniform scale of the transformation relative to the viewport along the X-axis.
 
Get the uniform scale of the transformation relative to the viewport along the Y-axis.
 
Get the rotation of the transformation.
 
Get the uniform scale of the transformation.
 
Get the non-uniform scale along the X-axis of the transformation.
 
Get the non-uniform scale along the Y-axis of the transformation.
 
Releases the component back into the object pool.
 
setLastPosition(point, y)
Set the last position that the transformation was at.
 
setPosition(point, y)
Set the position of the transform.
 
setRotation(rotation)
Set the rotation of the transformation.
 
setScale(scaleX, scaleY)
Set the scale of the transform.
Methods borrowed from class R.components.Base:
getGameObject, getHostObject, getPriority, getType, getTypeString, setGameObject, setHostObject, setPriority
Methods borrowed from class R.engine.BaseObject:
addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
Methods borrowed from class R.engine.PooledObject:
clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.Transform2D(name, priority)
Create a 2d transformation component
Parameters:
name
{String} The name of the component
priority Optional, Default: 1.0
{Number} The priority of the component
Method Detail
destroy()
Destroy the component instance

execute(renderContext, time, dt)
Set the components of a transformation: position, rotation, and scale, within the rendering context.
Parameters:
renderContext
{R.rendercontexts.AbstractRenderContext} The rendering context
time
{Number} The engine time in milliseconds
dt
{Number} The delta between the world time and the last time the world was updated in milliseconds.

{String} getClassName()
Get the class name of this object
Returns:
{String} "R.components.Transform2D"

{R.math.Point2D} getLastPosition()
Get the last position of the transformation relative to the world.
Returns:
{R.math.Point2D}

{R.math.Point2D} getLastRenderPosition()
Get the last position of the transformation relative to the viewport.
Returns:
{R.math.Point2D}

{R.math.Point2D} getPosition()
Returns the position of the transformation relative to the world.
Returns:
{R.math.Point2D}

{R.math.Point2D} getRenderPosition()
Returns the position of the transformation relative to the viewport. If the world is comprised of multiple viewports (wide and/or tall) the render position is relative to the current viewport's position.
Returns:
{R.math.Point2D}

{Number} getRenderRotation()
Get the rotation of the transformation relative to the viewport.
Returns:
{Number}

{Number} getRenderScale()
Get the uniform scale of the transformation relative to the viewport.
Returns:
{Number}

{Number} getRenderScaleX()
Get the uniform scale of the transformation relative to the viewport along the X-axis.
Returns:
{Number}

{Number} getRenderScaleY()
Get the uniform scale of the transformation relative to the viewport along the Y-axis.
Returns:
{Number}

{Number} getRotation()
Get the rotation of the transformation.
Returns:
{Number}

{Number} getScale()
Get the uniform scale of the transformation.
Returns:
{Number}

{Number} getScaleX()
Get the non-uniform scale along the X-axis of the transformation.
Returns:
{Number}

{Number} getScaleY()
Get the non-uniform scale along the Y-axis of the transformation.
Returns:
{Number}

release()
Releases the component back into the object pool. See PooledObject#release for more information.

setLastPosition(point, y)
Set the last position that the transformation was at.
Parameters:
point
{Number|R.math.Point2D} The last X coordinate, or last position
y Optional
{Number} If point was a number, this is the Y coordinate

setPosition(point, y)
Set the position of the transform.
Parameters:
point
{Number|R.math.Point2D} The X coordinate, or the position
y Optional
{Number} If point was a number, this is the Y coordinate

setRotation(rotation)
Set the rotation of the transformation.
Parameters:
rotation
{Number} The rotation

setScale(scaleX, scaleY)
Set the scale of the transform. You can apply a uniform scale by assigning only the first argument a value. To use a non-uniform scale, use both the X and Y arguments.
Parameters:
scaleX
{Number} The scale of the transformation along the X-axis with 1.0 being 100%
scaleY Optional
{Number} The scale of the transformation along the Y-axis. If provided, a non-uniform scale can be achieved by using a number which differs from the X-axis.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:18 GMT-0400 (EDT)