float () { float delta=(myEndRatio-myStartRatio)/(float)TOTAL_FRAME_COUNT; if(myStartRatio>myEndRatio){ // dialog is becoming non transparent quicker delta*=2; } final float ratio=myStartRatio+(float)myCurrentFrame*delta; return MathUtil.clamp(ratio, .0f, 1.0f); }