const {ccclass, property} = cc._decorator;

@ccclass
export default class ScaleNode extends cc.Component {
    @property(cc.Float)
    scaleStart: number = 1;

    @property(cc.Float)
    scaleEnd: number = 1;

    @property(cc.Float)
    delayTime: number = 1;

    @property(cc.Float)
    time: number = 0.2;

    @property(cc.Float)
    opacityNum: number = 0;
    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.node.scale = this.scaleStart;
        cc.tween(this.node).delay(this.delayTime)
        .repeatForever(
            cc.tween()
            .to(this.time, { scale: this.scaleEnd})
            .to(this.time*3, { opacity: this.opacityNum })
            .call(()=>{
                this.node.scale = this.scaleStart;
                this.node.opacity = 255;
            })
        )
        .start()
    }

    start () {

    }

    // update (dt) {}
}