Constructor
new SpriteAnimateRenderable(myTexture)
Parameters:
| Name | Type | Description |
|---|---|---|
myTexture |
string | path to the sprite sheet image file for this SpriteAnimateRenderable |
Extends
Members
(static, constant) eAnimationType
Enum for direction of the animation sequence.
Assumption is that the first sprite in an animation is always the left-most element
Methods
draw(camera)
Draw this SpriteRenderable to the camera
Parameters:
| Name | Type | Description |
|---|---|---|
camera |
Camera | the Camera to draw to |
- Inherited From:
- Source:
getElementUVCoordinateArray() → {Array.<float>}
Returns a one dimensional array with UV coordinates of the corners of the sprite region for this SpriteRenderable
- Inherited From:
- Source:
Returns:
top-right: [0][1], top-left: [2][3], bottom-right: [4][5], bottom-left: [6][7]
- Type
- Array.<float>
incAnimationSpeed(deltaInterval)
Add a value to the animation advancement interval
Parameters:
| Name | Type | Description |
|---|---|---|
deltaInterval |
integer | the value to add to the advancement interval |
setAnimationSpeed(tickInterval)
Set how many update calls before advancing the animation of this SpriteAnimateRenderable
Parameters:
| Name | Type | Description |
|---|---|---|
tickInterval |
integer | animation advancement interval |
setAnimationType(animationType)
Set the animation type for this SpriteAnimateRenderable and restart the animation
Parameters:
| Name | Type | Description |
|---|---|---|
animationType |
eAnimationType | methodology for moving through the sprite sequence |
setElementPixelPositions(left, right, bottom, top)
Set the sprite element bounds in pixel coordinates (between 0 to image resolutions) for this Sprite Renderable
Parameters:
| Name | Type | Description |
|---|---|---|
left |
integer | leftmost pixel position |
right |
integer | rightmost pixel position |
bottom |
integer | bottommost pixel position |
top |
integer | topmost pixel position |
- Inherited From:
- Source:
setElementUVCoordinate(left, right, bottom, top)
Set the sprite element bounds in UV texture coordinate (0-1) for this Sprite Renderable
Parameters:
| Name | Type | Description |
|---|---|---|
left |
float | leftmost U coordinate |
right |
float | rightmost U coordinate |
bottom |
float | bottommost V coordinate |
top |
float | topmost V coordinate |
- Inherited From:
- Source:
setSpriteSequence(topPixel, leftPixel, elmWidthInPixel, elmHeightInPixel, numElements, wPaddingInPixel)
Set the sequence of sprite elements that make up the animation for this SpriteAnimateRenderable
Parameters:
| Name | Type | Description |
|---|---|---|
topPixel |
integer | vertical pixel offset from the top-left of the sprite sheet |
leftPixel |
integer | horizontal pixel offset from the top-left of the sprite sheet |
elmWidthInPixel |
integer | pixel width of an individual sprite element in the sequence |
elmHeightInPixel |
integer | pixel height of an individual sprite element in the sequence |
numElements |
integer | number of sprites in the animation sequence |
wPaddingInPixel |
integer | number of horizontal padding pixels between elements |
updateAnimation()
Update this SpriteAnimatedRenderable, advancing the current sprite element if the update interval has passed