stopAnimation() (since version 2.0.0)
Stop the sprite animation.
Description
Stop 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. Then we start the sprite animation. Finally we add an event handler that will stop the animation using this method when the object is clicked.
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();
sprite.bind("click tap", function () {
this.stopAnimation();
});
Output