private List<AnimParameter> createAnimParamList(TweenParameter tweenParameter,int position){
  List<AnimParameter> params=new ArrayList<>();
  long animParamNum=tweenParameter.animDuration / mFps;
  if (animParamNum < 1) {
    animParamNum=1;
  }
  float cntX;
  float cntY;
  int cntAlpha;
  float cntRotation;
  float cntScaleX;
  float cntScaleY;
  AnimParameter beforeParam=position == 0 ? mInitialParam : mTweenParameters.get(position - 1);
  cntX=(tweenParameter.x - beforeParam.x) / animParamNum;
  cntY=(tweenParameter.y - beforeParam.y) / animParamNum;
  cntAlpha=(int)((tweenParameter.alpha - beforeParam.alpha) / animParamNum);
  cntRotation=(tweenParameter.rotation - beforeParam.rotation) / animParamNum;
  cntScaleX=(tweenParameter.scaleX - beforeParam.scaleX) / animParamNum;
  cntScaleY=(tweenParameter.scaleY - beforeParam.scaleY) / animParamNum;
  if (tweenParameter.angle == TweenParameter.DEFAULT_ANGLE) {
    for (int i=0; i < animParamNum; i++) {
      float elapsedTimeRate=(float)i / (float)animParamNum;
      float valueChangeRate=EaseProvider.get(tweenParameter.ease,elapsedTimeRate);
      AnimParameter animParameter=new AnimParameter(beforeParam.x + cntX * i * valueChangeRate,beforeParam.y + cntY * i * valueChangeRate,(int)(beforeParam.alpha + cntAlpha * i * valueChangeRate),beforeParam.scaleX + cntScaleX * i * valueChangeRate,beforeParam.scaleY + cntScaleY * i * valueChangeRate,beforeParam.rotation + cntRotation * i * valueChangeRate);
      params.add(animParameter);
    }
  }
 else {
    float differX=tweenParameter.x - beforeParam.x;
    float differY=tweenParameter.y - beforeParam.y;
    float halfDifferX=differX / 2;
    float halfDifferY=differY / 2;
    float baseLineLength=(float)Math.sqrt(halfDifferX * halfDifferX + halfDifferY * halfDifferY);
    double baseRadian=Math.atan2(differY,differX);
    double baseDegree=Math.toDegrees(baseRadian);
    double cosRadius=90 - (tweenParameter.angle / 2);
    double distance=(baseLineLength / Math.cos(Math.toRadians(cosRadius)));
    float plusAngle=0;
    float startAngle=0;
    if (beforeParam.x >= tweenParameter.x && beforeParam.y <= tweenParameter.y) {
      plusAngle=0;
      startAngle=(float)(plusAngle + (90 - tweenParameter.angle) / 2 + baseDegree - 90 - 45f);
    }
 else     if (beforeParam.x >= tweenParameter.x && beforeParam.y > tweenParameter.y) {
      plusAngle=90;
      startAngle=(float)(plusAngle + (90 - tweenParameter.angle) / 2 + -(-180 - baseDegree) - 45f);
    }
 else     if (beforeParam.x < tweenParameter.x && beforeParam.y > tweenParameter.y) {
      plusAngle=180;
      startAngle=(float)(plusAngle + (90 - tweenParameter.angle) / 2 + -(-90 - baseDegree) - 45f);
    }
 else     if (beforeParam.x < tweenParameter.x && beforeParam.y <= tweenParameter.y) {
      plusAngle=270;
      startAngle=(float)(plusAngle + (90 - tweenParameter.angle) / 2 + baseDegree - 45f);
    }
    PointF differPointF=Util.getPointByDistanceAndDegree(distance,startAngle);
    float differBaseX=beforeParam.x - differPointF.x;
    float differBaseY=beforeParam.y - differPointF.y;
    float cntAngle=tweenParameter.angle / animParamNum;
    for (int i=0; i < animParamNum; i++) {
      float elapsedTimeRate=(float)i / (float)animParamNum;
      float valueChangeRate=EaseProvider.get(tweenParameter.ease,elapsedTimeRate);
      float angle=startAngle + cntAngle * (i + 1) * valueChangeRate;
      PointF pointF=Util.getPointByDistanceAndDegree(distance,angle);
      AnimParameter animParameter=new AnimParameter(pointF.x + differBaseX,pointF.y + differBaseY,(int)(beforeParam.alpha + cntAlpha * i * valueChangeRate),beforeParam.scaleX + cntScaleX * i * valueChangeRate,beforeParam.scaleY + cntScaleY * i * valueChangeRate,beforeParam.rotation + cntRotation * i * valueChangeRate);
      params.add(animParameter);
    }
  }
  return params;
}

private List < AnimParameter > createAnimParamList ( TweenParameter tweenParameter , int position ) { List < AnimParameter > params = new ArrayList < > ( ) ; long animParamNum = tweenParameter . animDuration / mFps ; if ( animParamNum < 1 ) { animParamNum = 1 ; } float cntX ; float cntY ; int cntAlpha ; float cntRotation ; float cntScaleX ; float cntScaleY ; AnimParameter beforeParam = position == 0 ? mInitialParam : mTweenParameters . get ( position - 1 ) ; cntX = ( tweenParameter . x - beforeParam . x ) / animParamNum ; cntY = ( tweenParameter . y - beforeParam . y ) / animParamNum ; cntAlpha = ( int ) ( ( tweenParameter . alpha - beforeParam . alpha ) / animParamNum ) ; cntRotation = ( tweenParameter . rotation - beforeParam . rotation ) / animParamNum ; cntScaleX = ( tweenParameter . scaleX - beforeParam . scaleX ) / animParamNum ; cntScaleY = ( tweenParameter . scaleY - beforeParam . scaleY ) / animParamNum ; if ( tweenParameter . angle == TweenParameter . DEFAULT_ANGLE ) { for ( int i = 0 ; i < animParamNum ; i ++ ) { float elapsedTimeRate = ( float ) i / ( float ) animParamNum ; float valueChangeRate = EaseProvider . get ( tweenParameter . ease , elapsedTimeRate ) ; AnimParameter animParameter = new AnimParameter ( beforeParam . x + cntX * i * valueChangeRate , beforeParam . y + cntY * i * valueChangeRate , ( int ) ( beforeParam . alpha + cntAlpha * i * valueChangeRate ) , beforeParam . scaleX + cntScaleX * i * valueChangeRate , beforeParam . scaleY + cntScaleY * i * valueChangeRate , beforeParam . rotation + cntRotation * i * valueChangeRate ) ; params . add ( animParameter ) ; } } else { float differX = tweenParameter . x - beforeParam . x ; float differY = tweenParameter . y - beforeParam . y ; float halfDifferX = differX / 2 ; float halfDifferY = differY / 2 ; float baseLineLength = ( float ) Math . sqrt ( halfDifferX * halfDifferX + halfDifferY * halfDifferY ) ; double baseRadian = Math . atan2 ( differY , differX ) ; double baseDegree = Math . toDegrees ( baseRadian ) ; double cosRadius = 90 - ( tweenParameter . angle / 2 ) ; double distance = ( baseLineLength / Math . cos ( Math . toRadians ( cosRadius ) ) ) ; float plusAngle = 0 ; float startAngle = 0 ; if ( beforeParam . x >= tweenParameter . x && beforeParam . y <= tweenParameter . y ) { plusAngle = 0 ; startAngle = ( float ) ( plusAngle + ( 90 - tweenParameter . angle ) / 2 + baseDegree - 90 - 45f ) ; } else if ( beforeParam . x >= tweenParameter . x && beforeParam . y > tweenParameter . y ) { plusAngle = 90 ; startAngle = ( float ) ( plusAngle + ( 90 - tweenParameter . angle ) / 2 + - ( - 180 - baseDegree ) - 45f ) ; } else if ( beforeParam . x < tweenParameter . x && beforeParam . y > tweenParameter . y ) { plusAngle = 180 ; startAngle = ( float ) ( plusAngle + ( 90 - tweenParameter . angle ) / 2 + - ( - 90 - baseDegree ) - 45f ) ; } else if ( beforeParam . x < tweenParameter . x && beforeParam . y <= tweenParameter . y ) { plusAngle = 270 ; startAngle = ( float ) ( plusAngle + ( 90 - tweenParameter . angle ) / 2 + baseDegree - 45f ) ; } PointF differPointF = Util . getPointByDistanceAndDegree ( distance , startAngle ) ; float differBaseX = beforeParam . x - differPointF . x ; float differBaseY = beforeParam . y - differPointF . y ; float cntAngle = tweenParameter . angle / animParamNum ; for ( int i = 0 ; i < animParamNum ; i ++ ) { float elapsedTimeRate = ( float ) i / ( float ) animParamNum ; float valueChangeRate = EaseProvider . get ( tweenParameter . ease , elapsedTimeRate ) ; float angle = startAngle + cntAngle * ( i + 1 ) * valueChangeRate ; PointF pointF = Util . getPointByDistanceAndDegree ( distance , angle ) ; AnimParameter animParameter = new AnimParameter ( pointF . x + differBaseX , pointF . y + differBaseY , ( int ) ( beforeParam . alpha + cntAlpha * i * valueChangeRate ) , beforeParam . scaleX + cntScaleX * i * valueChangeRate , beforeParam . scaleY + cntScaleY * i * valueChangeRate , beforeParam . rotation + cntRotation * i * valueChangeRate ) ; params . add ( animParameter ) ; } } return params ; }
it generates a animparam sequences required in tween .
