import { getSkinPath } from "../utils";

/**
 * 单条收支记录
 */
export default class FriendItem extends eui.Component {


    public mask_load_1:eui.Rect;
    public mask_load_2:eui.Rect;
    public load_1:eui.Image;
    public load_2:eui.Image;



    loadVal=100

 
    constructor(data?){
        super();
        this.skinName = getSkinPath('FrendItem');
        this.touchChildren = true;
        this.init();
    }

    public init():void{
        // this.height = 80;

        this.load_1.mask=this.mask_load_1;
        this.load_2.mask=this.mask_load_2;

       /*  var tw = egret.Tween.get( this.load_1, { loop:false} );
        tw.to( {rotation:180}, 500 ).call( 
           ()=>{
            var tw2 = egret.Tween.get( this.load_2, { loop:false} );
            tw2.to( {rotation:360}, 500 ).call( 
               ()=>{
    
               }
            )
           }
        ) */
        this.loadVal=50;
        this.setLoadVal()
    }

    setLoadVal(){
        if(this.loadVal<=50){
            this.load_2.rotation=180
            this.load_1.rotation=180*this.loadVal/50
        }else{
            this.load_1.rotation=180
            this.load_2.rotation=180+(180*(this.loadVal-50)/50)
        }
    }
}