Animation (Extends from Sprite)

Module: engine.renderer.animation

Animation that is generated from multiple textures. Animation can also contain multiple animations created with addAnim method.

new game.Animation(textures)

Parameters:

  • textures Array|String

    Array of textures or name of atlas file

Properties

_cached Boolean (Default: false)

(No description yet)

_cachedSprite Sprite

(No description yet)

_cosCache Number (Default: 1)

(No description yet)

_frameTime Number

(No description yet)

_interactive Boolean (Default: false)

(No description yet)

_lastTransformUpdate Number

(No description yet)

_localTransform Matrix

(No description yet)

_parent Container

(No description yet)

_rotationCache Number (Default: 0)

(No description yet)

_sinCache Number (Default: 0)

(No description yet)

_tintAlpha Number

(No description yet)

_tintColor String

(No description yet)

_worldAlpha Number (Default: 1)

(No description yet)

_worldBounds Rectangle

(No description yet)

_worldTransform Matrix

(No description yet)

alpha Number (Default: 1)
Container opacity, 0 makes it invisible.
anchor Vector

(No description yet)

anims Object

List of animations.

blendMode String (Default: source-over)
Blend mode for sprite rendering.
buttonMode Boolean (Default: false)
Change cursor, when mouse is over the container. Define cursor at game.Input.buttonModeCursor.
cache Boolean (Default: false)
Cache container content as bitmap.
children Array

(No description yet)

currentAnim Animation

Current active animation.

currentFrame Number (Default: 0)

Current frame index.

height Number

(No description yet)

hitArea Rectangle|Circle

(No description yet)

interactive Boolean (Default: false)

(No description yet)

loop Boolean (Default: true)

Is animation looping.

mask Graphics

(No description yet)

onComplete Function

Function that is called, when animation is completed.

parent Container

(No description yet)

playing Boolean (Default: false)

Is animation playing.

position Vector

(No description yet)

random Boolean (Default: false)

Play animation in random order.

renderable Boolean (Default: true)

(No description yet)

reverse Boolean (Default: false)

Play animation in reverse.

rotation Number (Default: 0)

(No description yet)

scale Vector

(No description yet)

skew Vector

(No description yet)

speed Number (Default: 10)

Animation speed (frames per second).

stage Container

(No description yet)

texture Texture
Texture for sprite.
textures Array

List of textures.

tint String
Tint sprite with color.
tintAlpha Number (Default: 1)
Alpha of sprite tint.
tintCrop Rectangle
Crop tint area. x is from left, y is from top, width is from right and height is from bottom.
visible Boolean (Default: true)
Visibility. If set to false, rendering and interactivity will be disabled.
width Number

(No description yet)

x Number
Shorthand for position.x
y Number
Shorthand for position.y

Methods

_destroyCachedSprite()

(No description yet)

_destroyTintedTexture()

(No description yet)

_generateCachedSprite()

(No description yet)

_generateTintedTexture(color) Texture

(No description yet)

Parameters:

  • color String
_getBounds() Rectangle

(No description yet)

_worldBounds
_removeStageReference()

(No description yet)

_render(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderCanvas(context, [transform], [rect], [offset])

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
  • transform Matrix (optional)
  • rect Rectangle (optional)
  • offset Rectangle (optional)
_renderChildren(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_setStageReference(stage)

(No description yet)

Parameters:

  • stage Container
_updateAnimation()

(No description yet)

_updateChildTransform()

(No description yet)

_updateParentTransform()

(No description yet)

addAnim(name, frames, [frameCount], [props])

Add new animation.

Parameters:

  • name String

    Name of animation.

  • frames Array|Number

    List of invidual frame indexes or start frame index.

  • frameCount Number|Object (optional)

    Number of frames or animation properties.

  • props Object (optional)

    Animation properties.

addChild(child)

(No description yet)

Parameters:

  • child Container
addChildAt(child, index)

(No description yet)

Parameters:

  • child Container
  • index Number
addTo(container, [index])
Add this to container.

Parameters:

  • container Container
  • index Number (optional)
anchorCenter()

(No description yet)

center(target, [offsetX], [offsetY], [worldPos])
Position container to center of target.

Parameters:

  • target Container
  • offsetX Number (optional)
  • offsetY Number (optional)
  • worldPos Boolean (optional) Use world position.
click(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
fromTextures(name) Animation Static

Create animation from textures starting with name.

Parameters:

  • name String
gotoFrame(frame)

Jump to specific frame.

Parameters:

  • frame Number

    Frame index

hitTest(target) Boolean
Test if container's bounds are overlapping target's bounds.

Parameters:

  • target Container
mousedown(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
Return true, to skip to next object.
mousemove(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
Return true, to skip to next object.
mouseout(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
mouseover(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
mouseup(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
Return true, to skip to next object.
mouseupoutside(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
onScreen() Boolean
Check if container is on the screen.
Return true, if on the screen.
play([name], [frame])

Play animation.

Parameters:

  • name String|Number (optional)

    Name of animation or frame index

  • frame Number (optional)

    Frame index

remove()
Remove this from it's parent.
removeAll()
Remove all childrens.
removeChild(child)
Remove children.

Parameters:

  • child Container
setTexture(texture)

(No description yet)

Parameters:

  • texture Texture|String
stop([frame])

Stop animation.

Parameters:

  • frame Number (optional)

    Frame index

swap(container)
Swap container position with this container.

Parameters:

  • container Container
swapChildren(child, child2)
Swap position of two childrens.

Parameters:

  • child Container
  • child2 Container
toBottom()
Move container to first children.
toTop()
Move container to last children.
toWorldPosition([vector], [local]) Vector
Get current world position

Parameters:

  • vector Vector (optional) Vector to set world position
  • local Boolean (optional) Convert world position to local position
Returns new Vector, if vector parameter not defined
updateTransform()

(No description yet)

Attributes

_tintedTextures Array

(No description yet)