| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- cc.Class({
- extends: cc.Component,
- properties: {
- FadeTag : null
- },
- start () {
- this.node.setLocalZOrder(999999);
- this.FadeTag = false;
- },
- onload : function () {
- },
- FadeInAndOut:function(callbackFadeIn,callbackFadeOut)
- {
- cc.log("准备黑屏",this.FadeTag);
- if (this.FadeTag) {
- return;
- }
- this.node.opacity=0;
- // this.FadeOut(10,function () {
- //
- // }.bind(this));
- this.FadeTag = true;
- this.FadeIn(3,function () {
- if (callbackFadeIn != null) {
- callbackFadeIn();
- }
- setTimeout(function () {
- this.FadeOut(3,function () {
- if (callbackFadeOut != null) {
- callbackFadeOut();
- this.FadeTag = false;
- }
- }.bind(this));
- }.bind(this),300);
- }.bind(this));
- // this.FadeTag = true;
- },
- // FadeInAndOutControl : function (tag) {
- // if (tag) {
- // this.node.opacity+=4;
- // }else {
- //
- // }
- // },
- FadeIn:function(duration,fun)
- {
- var rate = duration/255;
- this.schedule(function()
- {
- if(this.node.opacity>=250)
- {
- if(this.node.opacity==255)
- {
- if(fun!=null)
- {
- fun();
- }
- }
- this.node.opacity =255;
- return;
- }
- this.node.opacity +=5;
- }, rate,51);
- },
- FadeOut:function(duration,fun)
- {
- var rate = duration/255;
- this.schedule(function()
- {
- if(this.node.opacity<=5)
- {
- if(this.node.opacity==0)
- {
- if(fun!=null)
- {
- this.node.opacity =0;
- fun();
- }
- }
- this.node.opacity =0;
- return;
- }
- this.node.opacity -=5;
- }, rate,51);
- },
- FadeInCallBack:function()
- {
- },
- FadeOutCallBack:function()
- {
- },
- // update :function(dt) {
- // // if (this.FadeTag != null) {
- // // this.FadeInAndOutControl(this.FadeTag);
- // // }
- //
- // },
- });
|