const {ccclass, property} = cc._decorator;
@ccclass
export default class ScaleOpcaity extends cc.Component {
// 同时 缩放并且变透明
@property({type: cc.Float, displayName:"一个阶段多少秒"})
time : number = 0.4;
@property({type: cc.Float, displayName:"缩放多少"})
scaleMin : number = 0.5;
@property({type: cc.Integer, displayName:"透明度最大值"})
opacityMax : number = 255;
@property({type: cc.Integer, displayName:"透明度最小值"})
opacityMin : number = 150;
onLoad () {
let scaleX = this.node.scaleX;
let scaleY = this.node.scaleY;
cc.tween(this.node)
.repeatForever(
cc.tween(this.node)
.parallel(
cc.tween(this.node)
.to(this.time, {opacity : this.opacityMin})
.start(),
cc.tween(this.node)
.to(this.time, {scaleX : scaleX* this.scaleMin, scaleY : scaleY * this.scaleMin})
.start()
)
.parallel(
cc.tween(this.node)
.to(this.time, {opacity : this.opacityMax})
.start(),
cc.tween(this.node)
.to(this.time, {scaleX : scaleX, scaleY : scaleY})
.start()
)
.start()
.start()
)
.start()
}
}