private int CalculateAlpha(TouchObject tobject) { var aliveMillis = tobject.AliveMillis; var alpha = 255 * CalculateRatio(aliveMillis, ANIMATION_MILLISECONDS); return((int)alpha); }
private int CalculateTextSize(TouchObject tobject) { var aliveMillis = tobject.AliveMillis; var baseTextScale = TEXT_SCALE_MIN; var variableTextScale = TEXT_SCALE_MAX - TEXT_SCALE_MIN; var textSize = baseTextScale + (variableTextScale * CalculateRatio(aliveMillis, ANIMATION_MILLISECONDS)); return((int)textSize); }
private float CalculateRatio(TouchObject tobject, int animationMillis) { var aliveMillis = tobject.AliveMillis; if (aliveMillis > ANIMATION_MILLISECONDS) { return(0); } else { var ratio = 1 - (aliveMillis / (float)ANIMATION_MILLISECONDS); return(ratio); } }
private void AdjustTextPaint(TouchObject tobject, Paint textPaint) { textPaint.Alpha = CalculateAlpha(tobject); textPaint.TextSize = CalculateTextSize(tobject); }