Hi guys, I got a question :)
I want the user to fill in a number (e.g. 6). Let's say the maximum is 20. Then I want a bar to be filled from it's current 'fillness' (how far the bar is filled at that moment) till 30% (6/20*100). I didn't want this to happen in one tick, instead, I wanted it too fill slowly. Starting with a high fill-speed, ending with a slow fill-speed (or 0).
No matter how big the distance between the current 'fillness' and the target, it should always happen in 150 ticks, no less and no more.
I thought about using the formula ax^2+c with a > 0 (not realizing this would make the fill-speed start slow and end fast). Because <a> would depend on it's current 'fillness' and target I set <a> to ((Target- current value)/(MAXT^2)) where MAXT is a constant, it should reach the target MAXT ticks further (from the moment of starting). I've set MAXT to 150 ticks.
((Target-current value)/(MAXT^2))
because
target = a*MAXT^2+current value (current as in at the moment of starting to move)
a*MAXT^2+current value = target
a*MAXT = target - current value
a = ((Target-current value)/(MAXT^2))
Then, MAXT ticks after the moment of starting to fill I set a sprite which is the fill-color its width to a*(t^2)+c
This works fine, except that it starts filling with a high speed and becomes slower when it reaches its target.
So how do I make it start fast and end slow?
I tried several things which all didn't work as I want it too. Have you guys got any ideas?
Sorry for the terrible vocab (fillness ._.)