a2d.Tile - Armen138/a2d GitHub Wiki

extends a2d.Node

Defined in tile.js

Summary

a2d.Tile(image, opts)
Animated Tile Node

Method Summary

**[draw](#draw)** (canvas, forceScale) draws this node and its children
**[frameLoop](#frameLoop)** (range, updown) Initiate a frameloop
**[setTile](#setTile)** (t) set which tile to display
### Property Summary
_float_ **[angle](#angle)** angle
_number_ **[fps](#fps)** frames per second (does nothing if no frameloop is active)
_Image_ **[image](#image)**
_boolean_ **[loop](#loop)**
_float_ **[opacity](#opacity)** 1.0 is opaque, 0.0 is transparent
*a2d.Position* **[position](#position)**
*a2d.Vector* **[range](#range)**
_boolean_ **[scrollLock](#scrollLock)** Set this to true to make it ignore the scrolling offset.
_number_ **[tile](#tile)**
*a2d.Dimension* **[tileSize](#tileSize)**
### Event Summary
**[animationend](#animationend)** register this event to handle things when the animation ends.
#### Methods inherited from a2d.Events: addEventListener, emit, fireEvent, hasEvent, on, removeEventListener #### Methods inherited from a2d.Collection: append, indexOf, pop, push, remove, shift, unshift #### Methods inherited from a2d.Node: findNodeAt

Detail

a2d.Tile(image, opts)
Animated Tile Node

Parameters:

{Image} image
opts


Method Detail

draw (canvas, forceScale)
draws this node and its children

Parameters:

{HTMLCanvasElement} canvas optional
forceScale

-- frameLoop (range, updown)
Initiate a frameloop

Parameters:

{a2d.Vector} range
{boolean} updown

-- setTile (t)
set which tile to display

Parameters:

{number} t


Property Detail

{float} angle
angle

-- {number} fps
frames per second (does nothing if no frameloop is active)

-- {Image} image

-- {boolean} loop

-- {float} opacity
1.0 is opaque, 0.0 is transparent

-- {a2d.Position} position

-- {a2d.Vector} range

-- {boolean} scrollLock
Set this to true to make it ignore the scrolling offset. Mostly useful for UI

-- {number} tile

-- {a2d.Dimension} tileSize


Event Detail

animationend
register this event to handle things when the animation ends.

Example:

animatedNode.on("animationend", function() {
  alert("animation ended.");
});

⚠️ **GitHub.com Fallback** ⚠️