I'm creating an app and this app has gesture controlled animation. I'm working on a deceleration algorithm, but I'm having a little trouble with a calculation.
I have a timer served by an interval
(in seconds) and I have a speed
of gesture swipe. I'm having a little trouble getting the initial time interval
the first time the timer fires an event.
I somehow need to map speed
to interval
to begin deceleration.
At it's fastest, speed
is 4000
and when speed
is 4000
I wish to return an interval
of 0.000001
- the smallest time interval and therefore the timer will fire faster.
At it's slowest, speed
is 0
and when speed
is 0
I wish to return an interval
of 0.01
- the largest time interval and therefore the timer will fire slower.
Thanks for any help you may give me.