class Ani {
    //抖动效果
    static shake(item) {
        // alert("抖动效果");
        let tween = cc.tween(item);
        tween.to(0.06, { angle: 10 })
            .to(0.06, { angle: 0 })
            .to(0.06, { angle: -10 })
            .to(0.06, { angle: 0 });
        tween.repeat(4);
        tween.start();
    }
    static scaleOut(item) {
        return new Promise<void>((resolve) => {
            let tween = cc.tween(item);
            tween.to(0.2, { scaleX: 0, scaleY: 0 })
                .call(() => { resolve() });
            tween.start();
        })
    }
    static scaleIn(item) {
        return new Promise<void>((resolve) => {
            item.scaleX = 0;
            item.scaleY = 0;
            let tween = cc.tween(item);
            tween.to(0.2, { scaleX: 1, scaleY: 1 })
                .call(() => { resolve() });
            tween.start();
        })
    }

    static flipX0(item) {
        return new Promise<void>((resolve) => {
            let itemScale = item.scaleY;
            item.scaleX = itemScale;
            let tween = cc.tween(item);
            tween.to(0.2, { scaleX: 0 })
                .call(() => { resolve() });
            tween.start();
        })
    }
    static flipX1(item) {
        return new Promise<void>((resolve) => {
            let itemScale = item.scaleY;
            item.scaleX = 0;
            let tween = cc.tween(item);
            tween.to(0.2, { scaleX: itemScale })
                .call(() => { resolve() });
            tween.start();
        })
    }
}
export default Ani;