
/**
 * 树叶动画
 */
export class LeavesAni extends egret.DisplayObjectContainer {
    leafLeft: egret.Bitmap;
    leafRight: egret.Bitmap;
    constructor() {
        super();
        this.leafLeft = new egret.Bitmap(RES.getRes("leafLeft_png"));
        this.leafLeft.x = 0;
        this.leafLeft.y = 119;
        this.leafLeft.alpha = 0;
        this.addChild(this.leafLeft);
        this.leafRight = new egret.Bitmap(RES.getRes("leafRight_png"));
        this.leafRight.x = 673;
        this.leafRight.y = 141;
        this.leafRight.alpha = 0;
        this.addChild(this.leafRight);
    }
    play() {
        egret.Tween.get(this.leafLeft, { loop: true })
            .set({ x: 0, y: 119 })
            .to({ x: 82, y: 161 + 119 }, 2000)
        egret.Tween.get(this.leafLeft, { loop: true })
            .set({ rotation: 0, alpha: 0 })
            .to({ alpha: 1 }, 300)
            .wait(250)
            .to({ rotation: -58 }, 950)
            .to({ rotation: -90, alpha: 0 }, 500)

        egret.Tween.get(this.leafRight, { loop: true })
            .set({ x: 673, y: 141 })
            .to({ x: 642, y: 193 }, 2000)
        egret.Tween.get(this.leafRight, { loop: true })
            .set({ alpha: 0 })
            .to({ alpha: 1 }, 200)
            .wait(300)
            .to({ alpha: 0 }, 1500)
    }
}