new Orientation()
This component handles the orientation of an entity. It maintains an orientationMatrix
property on the owner to describe the entity's orientation using an affine transformation matrix.
Several methods on this component accept either a 3x3 2D Array or a string to describe orientation changes. Accepted strings include:
- "horizontal" - This flips the entity around the y-axis.
- "vertical" - This flips the entity around the x-axis.
- "diagonal" - This flips the entity around the x=y axis.
- "diagonal-inverse" - This flips the entity around the x=-y axis.
- "rotate-90" - This rotates the entity 90 degrees clockwise.
- "rotate-180" - This rotates the entity 180 degrees clockwise (noticeable when tweening).
- "rotate-270" - This rotates the entity 90 degrees counter-clockwise.
NOTE: This component absorbs specific properties already on the entity into orientation:
- orientationMatrix: 3x3 2D array describing an affine transformation.
- If the above is not provided, these properties are used to set initial orientation. This is useful when importing Tiled maps.
- scaleX: absorb -1 if described
- scaleY: absorb -1 if described
- rotation: absorb 90 degree rotations
- Source:
Fires:
- platypus.Entity#event:orient-vector
- platypus.Entity#event:orientation-updated
- platypus.Entity#event:relocate-entity
Listens to Events:
- platypus.Entity#event:handle-logic
- platypus.Entity#event:append-transform
- platypus.Entity#event:complete-tweens
- platypus.Entity#event:drop-tweens
- platypus.Entity#event:load
- platypus.Entity#event:transform
- platypus.Entity#event:translate
- platypus.Entity#event:orient-vector
- platypus.Entity#event:prepend-transform
- platypus.Entity#event:remove-vector
- platypus.Entity#event:replace-transform
- platypus.Entity#event:tween-transform
Methods
tweenTransform(options)
This message causes the component to begin tweening the entity's orientation over a span of time into the new orientation.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
A list of key/value pairs describing the tween options.
|