From d3e73e35699f7a54cae840326b3719469a818c12 Mon Sep 17 00:00:00 2001
From: knoxHuang <821686174@qq.com>
Date: Tue, 15 Dec 2015 14:05:05 +0800
Subject: [PATCH] cc.Animation Renamed cc.SpriteFrameAnimation
cc.animationCache Renamed cc.spriteFrameAnimationCache
---
CCDebugger.js | 20 ++---
cocos2d/actions/CCActionInterval.js | 16 ++--
cocos2d/core/CCDirector.js | 4 +-
cocos2d/core/sprites/CCAnimation.js | 56 ++++++------
cocos2d/core/sprites/CCAnimationCache.js | 46 +++++-----
cocos2d/core/sprites/CCSprite.js | 2 +-
extensions/ccb-reader/CCNodeLoader.js | 6 +-
.../src/ActionsTest/ActionsTest.js | 10 +--
.../visual-tests/src/SpriteTest/SpriteTest.js | 90 +++++++++----------
9 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/CCDebugger.js b/CCDebugger.js
index 32a3b7db8f..6e70bc6c9c 100644
--- a/CCDebugger.js
+++ b/CCDebugger.js
@@ -134,17 +134,17 @@ cc._LogInfos = {
checkGLErrorDebug: "WebGL error %s",
- animationCache: {
- _addAnimationsWithDictionary: "cocos2d: cc.AnimationCache: No animations were found in provided dictionary.",
- _addAnimationsWithDictionary_2: "cc.AnimationCache. Invalid animation format",
- addAnimations: "cc.AnimationCache.addAnimations(): File could not be found",
- _parseVersion1: "cocos2d: cc.AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
- _parseVersion1_2: "cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",
- _parseVersion1_3: "cocos2d: cc.AnimationCache: None of the frames for animation '%s' were found in the cc.SpriteFrameCache. Animation is not being added to the Animation Cache.",
- _parseVersion1_4: "cocos2d: cc.AnimationCache: An animation in your dictionary refers to a frame which is not in the cc.SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
+ spriteFrameAnimationCache: {
+ _addAnimationsWithDictionary: "cocos2d: cc.SpriteFrameAnimationCache: No animations were found in provided dictionary.",
+ _addAnimationsWithDictionary_2: "cc.SpriteFrameAnimationCache. Invalid animation format",
+ addAnimations: "cc.SpriteFrameAnimationCache.addAnimations(): File could not be found",
+ _parseVersion1: "cocos2d: cc.SpriteFrameAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
+ _parseVersion1_2: "cocos2d: cc.SpriteFrameAnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",
+ _parseVersion1_3: "cocos2d: cc.SpriteFrameAnimationCache: None of the frames for animation '%s' were found in the cc.SpriteFrameCache. Animation is not being added to the Animation Cache.",
+ _parseVersion1_4: "cocos2d: cc.SpriteFrameAnimationCache: An animation in your dictionary refers to a frame which is not in the cc.SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
_parseVersion2: "cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
- _parseVersion2_2: "cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",
- addAnimations_2: "cc.AnimationCache.addAnimations(): Invalid texture file name",
+ _parseVersion2_2: "cocos2d: cc.SpriteFrameAnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",
+ addAnimations_2: "cc.SpriteFrameAnimationCache.addAnimations(): Invalid texture file name",
},
Sprite: {
diff --git a/cocos2d/actions/CCActionInterval.js b/cocos2d/actions/CCActionInterval.js
index 6166098da2..63bef576b6 100644
--- a/cocos2d/actions/CCActionInterval.js
+++ b/cocos2d/actions/CCActionInterval.js
@@ -3253,7 +3253,7 @@ cc.ReverseTime.create = cc.reverseTime;
/** Animates a sprite given the name of an Animation
* @class
* @extends cc.ActionInterval
- * @param {cc.Animation} animation
+ * @param {cc.SpriteFrameAnimation} animation
* @example
* // create the animation with animation
* var anim = new cc.Animate(dance_grey);
@@ -3269,7 +3269,7 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
/**
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
* create the animate with animation.
- * @param {cc.Animation} animation
+ * @param {cc.SpriteFrameAnimation} animation
*/
ctor:function (animation) {
cc.ActionInterval.prototype.ctor.call(this);
@@ -3279,14 +3279,14 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
},
/**
- * @return {cc.Animation}
+ * @return {cc.SpriteFrameAnimation}
*/
getAnimation:function () {
return this._animation;
},
/**
- * @param {cc.Animation} animation
+ * @param {cc.SpriteFrameAnimation} animation
*/
setAnimation:function (animation) {
this._animation = animation;
@@ -3301,7 +3301,7 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
},
/**
- * @param {cc.Animation} animation
+ * @param {cc.SpriteFrameAnimation} animation
* @return {Boolean}
*/
initWithAnimation:function (animation) {
@@ -3409,7 +3409,7 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
newArray.push(element.clone());
}
}
- var newAnim = new cc.Animation(newArray, locAnimation.getDelayPerUnit(), locAnimation.getLoops());
+ var newAnim = new cc.SpriteFrameAnimation(newArray, locAnimation.getDelayPerUnit(), locAnimation.getLoops());
newAnim.setRestoreOriginalFrame(locAnimation.getRestoreOriginalFrame());
var action = new cc.Animate(newAnim);
this._cloneDecoration(action);
@@ -3431,7 +3431,7 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
/**
* create the animate with animation
* @function
- * @param {cc.Animation} animation
+ * @param {cc.SpriteFrameAnimation} animation
* @return {cc.Animate}
* @example
* // example
@@ -3446,7 +3446,7 @@ cc.animate = function (animation) {
* create the animate with animation
* @static
* @deprecated since v3.0 please use cc.animate instead.
- * @param {cc.Animation} animation
+ * @param {cc.SpriteFrameAnimation} animation
* @return {cc.Animate}
*/
cc.Animate.create = cc.animate;
diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js
index 94a5339e07..cb007ff949 100644
--- a/cocos2d/core/CCDirector.js
+++ b/cocos2d/core/CCDirector.js
@@ -371,10 +371,10 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
},
/**
- * Removes cached all cocos2d cached data. It will purge the cc.textureCache, cc.spriteFrameCache, cc.animationCache
+ * Removes cached all cocos2d cached data. It will purge the cc.textureCache, cc.spriteFrameCache, cc.spriteFrameAnimationCache
*/
purgeCachedData: function () {
- cc.animationCache._clear();
+ cc.spriteFrameAnimationCache._clear();
cc.spriteFrameCache._clear();
cc.textureCache._clear();
},
diff --git a/cocos2d/core/sprites/CCAnimation.js b/cocos2d/core/sprites/CCAnimation.js
index ac60096ce8..63f058aa1c 100644
--- a/cocos2d/core/sprites/CCAnimation.js
+++ b/cocos2d/core/sprites/CCAnimation.js
@@ -155,10 +155,10 @@ cc.AnimationFrame.create = function(spriteFrame,delayUnits,userInfo){
/**
*
- * A cc.Animation object is used to perform animations on the cc.Sprite objects.
+ * A cc.SpriteFrameAnimation object is used to perform animations on the cc.Sprite objects.
*
- * The cc.Animation object contains cc.SpriteFrame objects, and a possible delay between the frames.
- * You can animate a cc.Animation object by using the cc.Animate action.
+ * The cc.SpriteFrameAnimation object contains cc.SpriteFrame objects, and a possible delay between the frames.
+ * You can animate a cc.SpriteFrameAnimation object by using the cc.Animate action.
*
* @class
* @extends cc._Class
@@ -168,23 +168,23 @@ cc.AnimationFrame.create = function(spriteFrame,delayUnits,userInfo){
*
* @example
* // 1. Creates an empty animation
- * var animation1 = new cc.Animation();
+ * var animation1 = new cc.SpriteFrameAnimation();
*
* // 2. Create an animation with sprite frames, delay and loops.
* var spriteFrames = [];
* var frame = cc.spriteFrameCache.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);
+ * var animation1 = new cc.SpriteFrameAnimation(spriteFrames);
+ * var animation2 = new cc.SpriteFrameAnimation(spriteFrames, 0.2);
+ * var animation2 = new cc.SpriteFrameAnimation(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);
+ * var animation1 = new cc.SpriteFrameAnimation(animationFrames);
+ * var animation2 = new cc.SpriteFrameAnimation(animationFrames, 0.2);
+ * var animation3 = new cc.SpriteFrameAnimation(animationFrames, 0.2, 2);
*
* //create an animate with this animation
* var action = cc.animate(animation1);
@@ -192,7 +192,7 @@ cc.AnimationFrame.create = function(spriteFrame,delayUnits,userInfo){
* //run animate
* sprite.runAction(action);
*/
-cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
+cc.SpriteFrameAnimation = cc._Class.extend({
_frames:null,
_loops:0,
_restoreOriginalFrame:false,
@@ -238,7 +238,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
},
/**
- * Adds a frame to a cc.Animation, the frame will be added with one "delay unit".
+ * Adds a frame to a cc.SpriteFrameAnimation, the frame will be added with one "delay unit".
* @param {cc.SpriteFrame} frame
*/
addSpriteFrame:function (frame) {
@@ -274,7 +274,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
},
/**
- * Initializes a cc.Animation with cc.AnimationFrame, do not call this method yourself, please pass parameters to constructor to initialize.
+ * Initializes a cc.SpriteFrameAnimation with cc.AnimationFrame, do not call this method yourself, please pass parameters to constructor to initialize.
* @param {Array} arrayOfAnimationFrames
* @param {Number} delayPerUnit
* @param {Number} [loops=1]
@@ -299,10 +299,10 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
/**
* Clone the current animation
- * @return {cc.Animation}
+ * @return {cc.SpriteFrameAnimation}
*/
clone: function(){
- var animation = new cc.Animation();
+ var animation = new cc.SpriteFrameAnimation();
animation.initWithAnimationFrames(this._copyFrames(), this._delayPerUnit, this._loops);
animation.setRestoreOriginalFrame(this._restoreOriginalFrame);
return animation;
@@ -310,10 +310,10 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
/**
* Clone the current animation
- * @return {cc.Animation}
+ * @return {cc.SpriteFrameAnimation}
*/
copyWithZone:function (pZone) {
- var pCopy = new cc.Animation();
+ var pCopy = new cc.SpriteFrameAnimation();
pCopy.initWithAnimationFrames(this._copyFrames(), this._delayPerUnit, this._loops);
pCopy.setRestoreOriginalFrame(this._restoreOriginalFrame);
return pCopy;
@@ -329,7 +329,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
/**
* Clone the current animation
* @param pZone
- * @returns {cc.Animation}
+ * @returns {cc.SpriteFrameAnimation}
*/
copy:function (pZone) {
return this.copyWithZone(null);
@@ -392,7 +392,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
},
/**
- * Returns total delay units of the cc.Animation.
+ * Returns total delay units of the cc.SpriteFrameAnimation.
* @return {Number}
*/
getTotalDelayUnits:function () {
@@ -400,7 +400,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
},
/**
- * Initializes a cc.Animation with frames and a delay between frames, do not call this method yourself, please pass parameters to constructor to initialize.
+ * Initializes a cc.SpriteFrameAnimation with frames and a delay between frames, do not call this method yourself, please pass parameters to constructor to initialize.
* @param {Array} frames
* @param {Number} delay
* @param {Number} [loops=1]
@@ -435,7 +435,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
* you need to manually invoke release function when you think this object is no longer needed, otherwise, there will be memory learks.
* retain and release function call should be paired in developer's game code.
* @function
- * @see cc.Animation#release
+ * @see cc.SpriteFrameAnimation#release
*/
retain:function () {
},
@@ -450,7 +450,7 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
* you need to manually invoke release function when you think this object is no longer needed, otherwise, there will be memory learks.
* retain and release function call should be paired in developer's game code.
* @function
- * @see cc.Animation#retain
+ * @see cc.SpriteFrameAnimation#retain
*/
release:function () {
}
@@ -459,19 +459,19 @@ cc.Animation = cc._Class.extend(/** @lends cc.Animation# */{
/**
* Creates an animation.
* @deprecated since v3.0, please use new construction instead
- * @see cc.Animation
+ * @see cc.SpriteFrameAnimation
* @param {Array} frames
* @param {Number} delay
* @param {Number} [loops=1]
- * @return {cc.Animation}
+ * @return {cc.SpriteFrameAnimation}
*/
-cc.Animation.create = function (frames, delay, loops) {
- return new cc.Animation(frames, delay, loops);
+cc.SpriteFrameAnimation.create = function (frames, delay, loops) {
+ return new cc.SpriteFrameAnimation(frames, delay, loops);
};
/**
* @deprecated since v3.0, please use new construction instead
- * @see cc.Animation
+ * @see cc.SpriteFrameAnimation
* @type {Function}
*/
-cc.Animation.createWithAnimationFrames = cc.Animation.create;
+cc.SpriteFrameAnimation.createWithAnimationFrames = cc.SpriteFrameAnimation.create;
diff --git a/cocos2d/core/sprites/CCAnimationCache.js b/cocos2d/core/sprites/CCAnimationCache.js
index 2255d6be35..6246e0b73c 100644
--- a/cocos2d/core/sprites/CCAnimationCache.js
+++ b/cocos2d/core/sprites/CCAnimationCache.js
@@ -26,21 +26,21 @@
/**
*
- * cc.animationCache is a singleton object that manages the Animations.
+ * cc.spriteFrameAnimationCache is a singleton object that manages the Animations.
* It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
*
* example
- * cc.animationCache.addAnimation(animation,"animation1");
+ * cc.spriteFrameAnimationCache.addAnimation(animation,"animation1");
*
* @class
- * @name cc.animationCache
+ * @name cc.spriteFrameAnimationCache
*/
-cc.animationCache = /** @lends cc.animationCache# */{
+cc.spriteFrameAnimationCache = {
_animations: {},
/**
- * Adds a cc.Animation with a name.
- * @param {cc.Animation} animation
+ * Adds a cc.SpriteFrameAnimation with a name.
+ * @param {cc.SpriteFrameAnimation} animation
* @param {String} name
*/
addAnimation:function (animation, name) {
@@ -48,7 +48,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
},
/**
- * Deletes a cc.Animation from the cache.
+ * Deletes a cc.SpriteFrameAnimation from the cache.
* @param {String} name
*/
removeAnimation:function (name) {
@@ -62,12 +62,12 @@ cc.animationCache = /** @lends cc.animationCache# */{
/**
*
- * Returns a cc.Animation that was previously added.
+ * Returns a cc.SpriteFrameAnimation that was previously added.
* If the name is not found it will return nil.
* You should retain the returned copy if you are going to use it.
*
* @param {String} name
- * @return {cc.Animation}
+ * @return {cc.SpriteFrameAnimation}
*/
getAnimation:function (name) {
if (this._animations[name])
@@ -78,7 +78,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
_addAnimationsWithDictionary:function (dictionary,plist) {
var animations = dictionary["animations"];
if (!animations) {
- cc.log(cc._LogInfos.animationCache._addAnimationsWithDictionary);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._addAnimationsWithDictionary);
return;
}
@@ -102,7 +102,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
this._parseVersion2(animations);
break;
default :
- cc.log(cc._LogInfos.animationCache._addAnimationsWithDictionary_2);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._addAnimationsWithDictionary_2);
break;
}
},
@@ -116,12 +116,12 @@ cc.animationCache = /** @lends cc.animationCache# */{
*/
addAnimations:function (plist) {
- cc.assert(plist, cc._LogInfos.animationCache.addAnimations_2);
+ cc.assert(plist, cc._LogInfos.spriteFrameAnimationCache.addAnimations_2);
var dict = cc.loader.getRes(plist);
if(!dict){
- cc.log(cc._LogInfos.animationCache.addAnimations);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache.addAnimations);
return;
}
@@ -137,7 +137,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
var delay = parseFloat(animationDict["delay"]) || 0;
var animation = null;
if (!frameNames) {
- cc.log(cc._LogInfos.animationCache._parseVersion1, key);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._parseVersion1, key);
continue;
}
@@ -145,7 +145,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
for (var i = 0; i < frameNames.length; i++) {
var spriteFrame = frameCache.getSpriteFrame(frameNames[i]);
if (!spriteFrame) {
- cc.log(cc._LogInfos.animationCache._parseVersion1_2, key, frameNames[i]);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._parseVersion1_2, key, frameNames[i]);
continue;
}
var animFrame = new cc.AnimationFrame();
@@ -154,13 +154,13 @@ cc.animationCache = /** @lends cc.animationCache# */{
}
if (frames.length === 0) {
- cc.log(cc._LogInfos.animationCache._parseVersion1_3, key);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._parseVersion1_3, key);
continue;
} else if (frames.length !== frameNames.length) {
- cc.log(cc._LogInfos.animationCache._parseVersion1_4, key);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._parseVersion1_4, key);
}
- animation = new cc.Animation(frames, delay, 1);
- cc.animationCache.addAnimation(animation, key);
+ animation = new cc.SpriteFrameAnimation(frames, delay, 1);
+ cc.spriteFrameAnimationCache.addAnimation(animation, key);
}
},
@@ -177,7 +177,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
var frameArray = animationDict["frames"];
if (!frameArray) {
- cc.log(cc._LogInfos.animationCache._parseVersion2, key);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._parseVersion2, key);
continue;
}
@@ -188,7 +188,7 @@ cc.animationCache = /** @lends cc.animationCache# */{
var spriteFrameName = entry["spriteframe"];
var spriteFrame = frameCache.getSpriteFrame(spriteFrameName);
if (!spriteFrame) {
- cc.log(cc._LogInfos.animationCache._parseVersion2_2, key, spriteFrameName);
+ cc.log(cc._LogInfos.spriteFrameAnimationCache._parseVersion2_2, key, spriteFrameName);
continue;
}
@@ -200,10 +200,10 @@ cc.animationCache = /** @lends cc.animationCache# */{
}
var delayPerUnit = parseFloat(animationDict["delayPerUnit"]) || 0;
- var animation = new cc.Animation();
+ var animation = new cc.SpriteFrameAnimation();
animation.initWithAnimationFrames(arr, delayPerUnit, loops);
animation.setRestoreOriginalFrame(restoreOriginalFrame);
- cc.animationCache.addAnimation(animation, key);
+ cc.spriteFrameAnimationCache.addAnimation(animation, key);
}
},
diff --git a/cocos2d/core/sprites/CCSprite.js b/cocos2d/core/sprites/CCSprite.js
index e11beae34a..849eea948b 100644
--- a/cocos2d/core/sprites/CCSprite.js
+++ b/cocos2d/core/sprites/CCSprite.js
@@ -512,7 +512,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{
setDisplayFrameWithAnimationName:function (animationName, frameIndex) {
cc.assert(animationName, cc._LogInfos.Sprite.setDisplayFrameWithAnimationName_3);
- var cache = cc.animationCache.getAnimation(animationName);
+ var cache = cc.spriteFrameAnimationCache.getAnimation(animationName);
if(!cache){
cc.log(cc._LogInfos.Sprite.setDisplayFrameWithAnimationName);
return;
diff --git a/extensions/ccb-reader/CCNodeLoader.js b/extensions/ccb-reader/CCNodeLoader.js
index a00117f193..f753e996cc 100644
--- a/extensions/ccb-reader/CCNodeLoader.js
+++ b/extensions/ccb-reader/CCNodeLoader.js
@@ -518,10 +518,10 @@ cc.NodeLoader = cc._Class.extend({
animationFile = cc.BuilderReader.lastPathComponent(animationFile);
if (animation != null && animation !== "") {
- var animationCache = cc.animationCache;
- animationCache.addAnimations(animationFile);
+ var spriteFrameAnimationCache = cc.spriteFrameAnimationCache;
+ spriteFrameAnimationCache.addAnimations(animationFile);
- ccAnimation = animationCache.getAnimation(animation);
+ ccAnimation = spriteFrameAnimationCache.getAnimation(animation);
}
return ccAnimation;
},
diff --git a/test/visual-tests/src/ActionsTest/ActionsTest.js b/test/visual-tests/src/ActionsTest/ActionsTest.js
index bf52b9d40a..9d4f55c4a5 100644
--- a/test/visual-tests/src/ActionsTest/ActionsTest.js
+++ b/test/visual-tests/src/ActionsTest/ActionsTest.js
@@ -972,7 +972,7 @@ var ActionAnimate = ActionsDemo.extend({
//
// Manual animation
//
- var animation = new cc.Animation();
+ var animation = new cc.SpriteFrameAnimation();
for (var i = 1; i < 15; i++) {
var frameName = "Images/grossini_dance_" + ((i < 10) ? ("0" + i) : i) + ".png";
animation.addSpriteFrameWithFile(frameName);
@@ -987,7 +987,7 @@ var ActionAnimate = ActionsDemo.extend({
// File animation
//
// With 2 loops and reverse
- var animCache = cc.animationCache;
+ var animCache = cc.spriteFrameAnimationCache;
animCache.addAnimations(s_animations2Plist);
var animation2 = animCache.getAnimation("dance_1");
@@ -2510,7 +2510,7 @@ var Issue1438 = ActionsDemo.extend({
//
// manual animation
//
- var animation = new cc.Animation();
+ var animation = new cc.SpriteFrameAnimation();
// Add 60 frames
for (var j = 0; j < 4; j++) {
@@ -2529,7 +2529,7 @@ var Issue1438 = ActionsDemo.extend({
//
// File animation
//
- var animCache = cc.animationCache;
+ var animCache = cc.spriteFrameAnimationCache;
animCache.addAnimations(s_animations2Plist);
var animation2 = animCache.getAnimation("dance_1");
animation2.setDelayPerUnit(1 / 60);
@@ -2835,7 +2835,7 @@ var ActionCustomTest = ActionsDemo.extend({
spriteTemp.runAction(tintBy);
spriteTemp = this.addandCreateSpriteTemp("cc.Animate");
- var animation = new cc.Animation();
+ var animation = new cc.SpriteFrameAnimation();
for (var i = 1; i < 15; i++) {
var frameName = "Images/grossini_dance_" + ((i < 10) ? ("0" + i) : i) + ".png";
animation.addSpriteFrameWithFile(frameName);
diff --git a/test/visual-tests/src/SpriteTest/SpriteTest.js b/test/visual-tests/src/SpriteTest/SpriteTest.js
index d4def5bee5..fca6d25907 100644
--- a/test/visual-tests/src/SpriteTest/SpriteTest.js
+++ b/test/visual-tests/src/SpriteTest/SpriteTest.js
@@ -1966,7 +1966,7 @@ var SpriteFrameTest = SpriteTestDemo.extend({
spriteFrameCache.addSpriteFrames(s_grossini_bluePlist, s_grossini_blue);
//
- // Animation using Sprite BatchNode
+ // SpriteFrameAnimation using Sprite BatchNode
//
this._sprite1 = new cc.Sprite("#grossini_dance_01.png");
this._sprite1.x = winSize.width / 2 - 80;
@@ -1985,7 +1985,7 @@ var SpriteFrameTest = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
this._sprite1.runAction(cc.animate(animation).repeatForever());
// to test issue #732, uncomment the following line
@@ -1993,7 +1993,7 @@ var SpriteFrameTest = SpriteTestDemo.extend({
this._sprite1.flippedY = false;
//
- // Animation using standard Sprite
+ // SpriteFrameAnimation using standard Sprite
//
this._sprite2 = new cc.Sprite("#grossini_dance_01.png");
this._sprite2.x = winSize.width / 2 + 80;
@@ -2015,7 +2015,7 @@ var SpriteFrameTest = SpriteTestDemo.extend({
// append frames from another batch
moreFrames = moreFrames.concat(animFrames);
- var animMixed = new cc.Animation(moreFrames, 0.3);
+ var animMixed = new cc.SpriteFrameAnimation(moreFrames, 0.3);
this._sprite2.runAction(cc.animate(animMixed).repeatForever());
@@ -2112,7 +2112,7 @@ var SpriteFrameAliasNameTest = SpriteTestDemo.extend({
spriteFrameCache.addSpriteFrames(s_grossini_aliasesPlist, s_grossini_aliases);
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
// A cc.SpriteBatchNode can reference one and only one texture (one .png file)
// Sprites that are contained in that texture can be instantiatied as cc.Sprites and then added to the cc.SpriteBatchNode
@@ -2141,7 +2141,7 @@ var SpriteFrameAliasNameTest = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
// 14 frames * 1sec = 14 seconds
sprite.runAction(cc.animate(animation).repeatForever());
this.testSprite = sprite;
@@ -2183,7 +2183,7 @@ var SpriteOffsetAnchorRotation = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite BatchNode
+ // SpriteFrameAnimation using Sprite BatchNode
//
var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("grossini_dance_01.png"));
sprite.x = winSize.width / 4 * (i + 1);
@@ -2222,7 +2222,7 @@ var SpriteOffsetAnchorRotation = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
sprite.runAction(cc.rotateBy(10, 360).repeatForever());
@@ -2275,7 +2275,7 @@ var SpriteBatchNodeOffsetAnchorRotation = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite BatchNode
+ // SpriteFrameAnimation using Sprite BatchNode
//
var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("grossini_dance_01.png"));
sprite.x = winSize.width / 4 * (i + 1);
@@ -2312,7 +2312,7 @@ var SpriteBatchNodeOffsetAnchorRotation = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
sprite.runAction(cc.rotateBy(10, 360).repeatForever());
@@ -2360,7 +2360,7 @@ var SpriteOffsetAnchorScale = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite BatchNode
+ // SpriteFrameAnimation using Sprite BatchNode
//
var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("grossini_dance_01.png"));
sprite.x = winSize.width / 4 * (i + 1);
@@ -2399,7 +2399,7 @@ var SpriteOffsetAnchorScale = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
var scale = cc.scaleBy(2, 2);
@@ -2458,7 +2458,7 @@ var SpriteBatchNodeOffsetAnchorScale = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite BatchNode
+ // SpriteFrameAnimation using Sprite BatchNode
//
var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("grossini_dance_01.png"));
sprite.x = winSize.width / 4 * (i + 1);
@@ -2496,7 +2496,7 @@ var SpriteBatchNodeOffsetAnchorScale = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
var scale = cc.scaleBy(2, 2);
@@ -2548,7 +2548,7 @@ var SpriteOffsetAnchorSkew = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
var sprite = new cc.Sprite("#grossini_dance_01.png");
sprite.x = winSize.width / 4 * (i + 1);
@@ -2586,7 +2586,7 @@ var SpriteOffsetAnchorSkew = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
var skewX = cc.skewBy(2, 45, 0);
@@ -2637,7 +2637,7 @@ var SpriteBatchNodeOffsetAnchorSkew = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
var sprite = new cc.Sprite("#grossini_dance_01.png");
sprite.x = winSize.width / 4 * (i + 1);
@@ -2675,7 +2675,7 @@ var SpriteBatchNodeOffsetAnchorSkew = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
animFrames = null;
@@ -2724,7 +2724,7 @@ var SpriteOffsetAnchorSkewScale = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("grossini_dance_01.png"));
sprite.x = winSize.width / 4 * (i + 1);
@@ -2762,7 +2762,7 @@ var SpriteOffsetAnchorSkewScale = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
animFrames = null;
@@ -2825,7 +2825,7 @@ var SpriteBatchNodeOffsetAnchorSkewScale = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
var sprite = new cc.Sprite("#grossini_dance_01.png");
sprite.x = winSize.width / 4 * (i + 1);
@@ -2863,7 +2863,7 @@ var SpriteBatchNodeOffsetAnchorSkewScale = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
animFrames = null;
@@ -2923,7 +2923,7 @@ var SpriteOffsetAnchorFlip = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
var sprite = new cc.Sprite("#grossini_dance_01.png");
sprite.x = winSize.width / 4 * (i + 1);
@@ -2961,7 +2961,7 @@ var SpriteOffsetAnchorFlip = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
animFrames = null;
@@ -3014,7 +3014,7 @@ var SpriteBatchNodeOffsetAnchorFlip = SpriteTestDemo.extend({
for (var i = 0; i < 3; i++) {
//
- // Animation using Sprite batch
+ // SpriteFrameAnimation using Sprite batch
//
var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame("grossini_dance_01.png"));
sprite.x = winSize.width / 4 * (i + 1);
@@ -3052,7 +3052,7 @@ var SpriteBatchNodeOffsetAnchorFlip = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.3);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.3);
sprite.runAction(cc.animate(animation).repeatForever());
animFrames = null;
@@ -3092,7 +3092,7 @@ var SpriteBatchNodeOffsetAnchorFlip = SpriteTestDemo.extend({
//------------------------------------------------------------------
var SpriteAnimationSplit = SpriteTestDemo.extend({
- _title:"Sprite: Animation + flip",
+ _title:"Sprite: SpriteFrameAnimation + flip",
ctor:function () {
//----start10----ctor
this._super();
@@ -3107,7 +3107,7 @@ var SpriteAnimationSplit = SpriteTestDemo.extend({
var frame5 = new cc.SpriteFrame(texture, cc.rect(132 * 1, 132 * 1, 132, 132));
//
- // Animation using Sprite BatchNode
+ // SpriteFrameAnimation using Sprite BatchNode
//
var sprite = new cc.Sprite(frame0);
sprite.x = winSize.width / 2;
@@ -3122,7 +3122,7 @@ var SpriteAnimationSplit = SpriteTestDemo.extend({
animFrames.push(frame4);
animFrames.push(frame5);
- var animation = new cc.Animation(animFrames, 0.2);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.2);
var animate = cc.animate(animation);
var delay = cc.delayTime(0.5);
var seq = cc.sequence(animate,
@@ -3338,7 +3338,7 @@ var SpriteBatchNodeChildren = SpriteTestDemo.extend({
animFrames.push(frame);
}
- var animation = new cc.Animation(animFrames, 0.2);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.2);
sprite1.runAction(cc.animate(animation).repeatForever());
// END NEW CODE
@@ -4398,12 +4398,12 @@ var SpriteSubclass = SpriteTestDemo.extend({
//------------------------------------------------------------------
//
-// AnimationCache
+// spriteFrameAnimationCache
//
//------------------------------------------------------------------
-var AnimationCacheTest = SpriteTestDemo.extend({
+var SpriteFrameAnimationCacheTest = SpriteTestDemo.extend({
- _title:"AnimationCache",
+ _title:"SpriteFrameAnimationCache",
_subtitle:"Sprite should be animated",
ctor:function () {
@@ -4426,10 +4426,10 @@ var AnimationCacheTest = SpriteTestDemo.extend({
animFrames.push(animFrame);
}
- var animation = new cc.Animation(animFrames, 0.2);
+ var animation = new cc.SpriteFrameAnimation(animFrames, 0.2);
// Add an animation to the Cache
- cc.animationCache.addAnimation(animation, "dance");
+ cc.spriteFrameAnimationCache.addAnimation(animation, "dance");
//
// create animation "dance gray"
@@ -4441,10 +4441,10 @@ var AnimationCacheTest = SpriteTestDemo.extend({
animFrames.push(frame);
}
- animation = new cc.Animation(animFrames, 0.2);
+ animation = new cc.SpriteFrameAnimation(animFrames, 0.2);
// Add an animation to the Cache
- cc.animationCache.addAnimation(animation, "dance_gray");
+ cc.spriteFrameAnimationCache.addAnimation(animation, "dance_gray");
//
// create animation "dance blue"
@@ -4456,12 +4456,12 @@ var AnimationCacheTest = SpriteTestDemo.extend({
animFrames.push(frame);
}
- animation = new cc.Animation(animFrames, 0.2);
+ animation = new cc.SpriteFrameAnimation(animFrames, 0.2);
// Add an animation to the Cache
- cc.animationCache.addAnimation(animation, "dance_blue");
+ cc.spriteFrameAnimationCache.addAnimation(animation, "dance_blue");
- var animCache = cc.animationCache;
+ var animCache = cc.spriteFrameAnimationCache;
var normal = animCache.getAnimation("dance");
normal.setRestoreOriginalFrame(true);
@@ -5021,9 +5021,9 @@ var SpriteDoubleResolution = SpriteTestDemo.extend({
}
});
-var AnimationCacheFile = SpriteTestDemo.extend({
+var SpriteFrameAnimationCacheFile = SpriteTestDemo.extend({
- _title:"AnimationCache - Load file",
+ _title:"SpriteFrameAnimationCache - Load file",
_subtitle:"Sprite should be animated",
ctor:function () {
@@ -5035,9 +5035,9 @@ var AnimationCacheFile = SpriteTestDemo.extend({
frameCache.addSpriteFrames(s_grossini_bluePlist);
// Purge previously loaded animation
- if(cc.animationCache._clear)
- cc.animationCache._clear();
- var animCache = cc.animationCache;
+ if(cc.spriteFrameAnimationCache._clear)
+ cc.spriteFrameAnimationCache._clear();
+ var animCache = cc.spriteFrameAnimationCache;
// Add an animation to the Cache
// XXX API-FIX XXX