startAnimation() (since version 2.0.0)

Start the sprite animation.

Syntax startAnimation()

Return Type displayObject

Description

Start the sprite animation.

Return Value

displayObject. Returns the display object itself.

Examples

Example 1

We start by creating a new core instance. Then we create the actual sprite and specify that we want to generate the frames for the sprite animation, based on the width, height and direction that we specify. We also specify the duration for each frame. At the end, we start the sprite animation using this method.

View Example
Code
var canvas = oCanvas.create({
	canvas: "#canvas"
});

var sprite = canvas.display.sprite({
	x: 177,
	y: 137,
	origin: { x: "center", y: "center" },
	image: "img/sprite.png",
	generate: true,
	width: 20,
	height: 20,
	direction: "x",
	duration: 60
});

canvas.addChild(sprite);

sprite.startAnimation();
Output