Class cc.Animation#ctor
- Defined in: CCAnimation.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
cc.Animation#ctor(frames, delay, loops)
Creates an animation.
|
Class Detail
cc.Animation#ctor(frames, delay, loops)
Creates an animation.
// 1. Creates an empty animation
var animation1 = new cc.Animation();
// 2. Create an animation with sprite frames, delay and loops.
var spriteFrames = [];
var frame = cache.getSpriteFrame("grossini_dance_01.png");
spriteFrames.push(frame);
var animation1 = new cc.Animation(spriteFrames);
var animation2 = new cc.Animation(spriteFrames, 0.2);
var animation2 = new cc.Animation(spriteFrames, 0.2, 2);
// 3. Create an animation with animation frames, delay and loops.
var animationFrames = [];
var frame = new cc.AnimationFrame();
animationFrames.push(frame);
var animation1 = new cc.Animation(animationFrames);
var animation2 = new cc.Animation(animationFrames, 0.2);
var animation3 = new cc.Animation(animationFrames, 0.2, 2);
- Parameters:
- {Array} frames
- {Number} delay
- {Number} loops Optional, Default: 1