I have a View which I need to scale with an acceleration, I mean, that when the scale is MIN_SCALE
, the velocity must be slow, but when the scale is near of MAX_SALE
, the velocity must be more fast. Now my velocity is always the same.
There is a number of frames that the View will use to do it's movement:
numberOfFrames = Math.round((float)ANIMATION_TIME/GameLoopThread.FRAME_PERIOD);
frameCount = 0;
and I calculate the scaleVelocity with that number of frames:
scaleVelocity = (MAX_SCALE-MIN_SCALE)/numberOfFrames;
Each game loop iteration, I update the scale of the view with this code:
if (frameCount<numberOfFrames) {
currentScale = currentScale + scaleVelocity;
frameCount++;
}
When frame count has reached the numberOfFrames
the animation must end.
How can I add acceleration to this code? take in mind that the acceleration must respect that the view needs to reach the MAX_SCALE
at last frame from the frameCount variable.