


export class MyHeartItem extends eui.Component{
    public valueX = -150;
    public valueY = -150;
    constructor(){
        super();
        this.skinName       = 'resource/skins/ui/MyHeartItem.exml';


        egret.Tween.get(this,{loop:false})
        .to({scaleX:1, scaleY:1}, 500)
    
        // egret.Tween.get(this,{loop:false})
        // .to({x:-255, y:-516}, 1000)

        this.valueX = 0 - Math.floor(Math.random() * 350 + 20);
        this.valueY = 0 - Math.floor(Math.random() * 400 + 20);
        egret.Tween.get(this).to({factor: 1}, 1000).call(() => {
            this.parent.removeChild(this);
        });

    }
    public get factor():number {
        return 0;
    }
    public set factor(value:number) {
        this.x = (1 - value) * (1 - value) * 0 + 2 * value * (1 - value) * this.valueX + value * value * -255;
        this.y = (1 - value) * (1 - value) * 0 + 2 * value * (1 - value) * this.valueY + value * value * -516;
    }
    private onSkinComplete():void{
       
    }

    public removeEvent():void{
        
    }
}