Fix abnormal effects in effectsTest

This commit is contained in:
ZhangMenghe 2015-08-14 15:58:31 +08:00
parent 0f3a2ca642
commit 45f6c16d72
1 changed files with 6 additions and 10 deletions

View File

@ -170,10 +170,6 @@ var Effect1 = EffectAdvanceTextLayer.extend({
var reuse = cc.reuseGrid(1);
var delay = cc.delayTime(8);
var orbit = cc.orbitCamera(5, 1, 2, 0, 180, 0, -90);
var orbit_back = orbit.reverse();
target.runAction(cc.sequence(orbit, orbit_back).repeatForever());
target.runAction(cc.sequence(lens, delay, reuse, waves));
}
});
@ -241,17 +237,15 @@ var Lens3DTarget = cc.Node.extend({
},
update: function(dt) {
this._lens3D.x = this.x;
this._lens3D.y = this.y;
this._lens3D.setPosition(this._position);
},
onEnter: function() {
cc.log("Lens3DTarget onEnter");
cc.Node.prototype.onEnter.call(this);
this.scheduleUpdate();
},
onExit: function() {
cc.log("Lens3DTarget onExit");
cc.Node.prototype.onExit.call(this);
this.unscheduleUpdate();
}
@ -271,6 +265,7 @@ var Effect4 = EffectAdvanceTextLayer.extend({
onEnter:function () {
this._super();
var bgNodeGrid = this.getChildByTag(EffectsAdvancedTest.TAG_BACKGROUND);
var lens = cc.lens3D(10, cc.size(32, 24), cc.p(100, 180), 150);
var move = cc.jumpBy(5, cc.p(380, 0), 100, 4);
var move_back = move.reverse();
@ -282,11 +277,12 @@ var Effect4 = EffectAdvanceTextLayer.extend({
*/
var director = cc.director;
var target = Lens3DTarget.create(lens);
// Please make sure the target been added to its parent.
this.addChild(target);
director.getActionManager().addAction(seq, target, false);
this.runAction(cc.sequence(lens, cc.callFunc(
bgNodeGrid.runAction(cc.sequence(lens, cc.callFunc(
function(sender) {
sender.removeChild(target, true);
}