Beispiel #1
0
        private int CalculateAlpha(TouchObject tobject)
        {
            var aliveMillis = tobject.AliveMillis;

            var alpha = 255 * CalculateRatio(aliveMillis, ANIMATION_MILLISECONDS);

            return((int)alpha);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
 private void AdjustTextPaint(TouchObject tobject, Paint textPaint)
 {
     textPaint.Alpha    = CalculateAlpha(tobject);
     textPaint.TextSize = CalculateTextSize(tobject);
 }