Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2016-0-4 21:22

Class enchant.Sprite

Class which can display images.

Class Summary
Constructor Attributes Constructor Name and Description
enchant.Sprite(width, height)
Field Summary
Field Attributes Field Name and Description
Index of the frame to be displayed.
Image displayed in the Sprite.
Fields borrowed from class enchant.Entity:
backgroundColor, buttonMode, buttonPressed, compositeOperation, debugColor, height, opacity, originX, originY, rotation, scaleX, scaleY, touchEnabled, visible, width
Fields borrowed from class enchant.Node:
age, parentNode, scene, x, y

Class Detail

enchant.Sprite(width, height)
var bear = new Sprite(32, 32);
bear.image = core.assets['chara1.gif'];
{Number} width
Sprite width.
{Number} height
Sprite height.

Field Detail

{Number|Array} frame
Index of the frame to be displayed. Frames with the same width and height as Sprite will be arrayed from upper left corner of the enchant.Sprite#image image. When a sequence of numbers is provided, the displayed frame will switch automatically. At the end of the array the sequence will restart. By setting a value within the sequence to null, the frame switching is stopped.
var sprite = new Sprite(32, 32);
sprite.frame = [0, 1, 0, 2]
//-> 0, 1, 0, 2, 0, 1, 0, 2,..
sprite.frame = [0, 1, 0, 2, null]
//-> 0, 1, 0, 2, (2, 2,.. :stop)
{enchant.Surface} image
Image displayed in the Sprite.