import { _decorator, Animation, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('clock_angle')
export class clock_angle extends Component {
    @property(Node) img_clock_minute:Node = null;
    @property(Node) img_clock_second:Node = null;

    public init(){
        this.img_clock_second.angle = 360;
        this.img_clock_minute.angle = 360;
    }
    public addSecond(){
        this.img_clock_second.angle -=30;
        if(this.img_clock_second.angle<=0){
            this.img_clock_second.angle = 360;
            this.scheduleOnce(()=>{
                this.img_clock_minute.angle-=30;
            },1)
        }
    }

    public play(){
        this.img_clock_minute.active = false;
        this.img_clock_second.active = false;
        this.scheduleOnce(()=>{
            this.img_clock_minute.active = true;
            this.img_clock_second.active = true;
        },0.6)
        this.node.getComponent(Animation).play()
    }
}


