延迟3秒,淡出效果


var HelloWorldLayer = cc.Layer.extend({
    sprite:null,
    ctor:function () {
        //
        // 1. super init first
        this._super();

        /
        // 2. add a menu item with "X" image, which is clicked to quit the program
        //    you may modify it.
        // ask the window size
        var size = cc.winSize;

        // add a "close" icon to exit the progress. it's an autorelease object
        var closeItem = new cc.MenuItemImage(
            res.CloseNormal_png,
            res.CloseSelected_png,
            function () {
                cc.log("Menu is clicked!");
            }, this);
        closeItem.attr({
            x: size.width - 20,
            y: 20,
            anchorX: 0.5,
            anchorY: 0.5
        });

        var menu = new cc.Menu(closeItem);
        menu.x = 0;
        menu.y = 0;
       this.addChild(menu, 1);

        /
        // 3. add your codes below...
        // add a label shows "Hello World"
        // create and initialize a label
        var helloLabel = new cc.LabelTTF("Hello World", "Arial", 38);
        // position the label on the center of the screen
        helloLabel.x = size.width / 2;
        helloLabel.y = 0;
        var helloLabel2 = new cc.LabelTTF("YCL", "Arial", 38);
        // position the label on the center of the screen
        helloLabel2.x = size.width / 2;
        helloLabel2.y = 50;
        // add the label as a child to this layer
        this.addChild(helloLabel2, 5);

        // add "HelloWorld" splash screen"
        this.sprite = new cc.Sprite(res.time_png);
        this.sprite.attr({
            x: size.width / 2,
            y: size.height / 2,
            scale: 0.5,
            rotation: 180
        });
 
      ;
       this.addChild(this.sprite, 0);
       this.sprite.setTag(100000);
     
       this.isAutoActionSucess(true);
    
        return true;
    },
isAutoActionSucess:function(bool)
{
    if(bool){
            this.scheduleOnce(function(){  
            this.setProgressBarFadeOut(this.sprite);
        }, 4);
}
},
setProgressBarFadeOut:function(sprite){
    var action = cc.fadeOut(5);
    var delay = cc.delayTime(1);
    console.log(11111);
    sprite.runAction(cc.sequence(action, delay.clone()));
},

});

var HelloWorldScene = cc.Scene.extend({
    onEnter:function () {
        this._super();
        var layer = new HelloWorldLayer();
        this.addChild(layer);
    }
});


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值