var manager = cc.Class({
extends: cc.Component,
properties: {
layerNum: {
type: cc.Integer, //使用整型定义
default: 0,
//使用notify函数监听属性变化
notify(oldValue) {
//减少无效赋值
if (oldValue === this.layerNum) {
return;
}
// this.node.index = this.layerNum;
this.index = this.layerNum;
}
}
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
// this.node.index = this.layerNum
this.index = this.layerNum
var self = this
// cc.log(this)
// cc.log(this.node)
// this.node.index = 0
// cc.log(children)
this.children = this.node.getChildren();
// cc.log(this.children)
this.children.forEach(function(item, index){
// cc.log(self.node.index)
// cc.log(index)
if(self.index === index){
item.active = true
}else{
item.active = false
}
})
},
next () {
var children = this.children
// cc.log(children)
// cc.log(this.index, children.length)
// cc.log(this.index < children.length)
if(this.index < children.length - 1){
// children[this.index].active = false
// children[this.index+1].active = true
children[this.index].runAction(cc.fadeOut(0.8))
children[this.index+1].opacity = 0
children[this.index+1].active = true
children[this.index+1].runAction(cc.fadeIn(0.8))
this.index++
}else{
cc.log('finish')
}
}
// update (dt) {},
});
我的manager,这里是淡入淡出效果,可以扩展其他效果
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 掐指一算,在v实习时间已经有足足10个月了。感谢这十个月,好人好事是一定要记录下来的。所以我打算以一个intern...
- 参考:http://blog.csdn.net/xushuai0616/article/details/55802725
- License Manager 对于每一个用Vuforia开发的AR程序来说,都有一个唯一的license key...