View Full Version : accelerated scrolling function

03-07-2005, 02:28 AM
as you may know, i am programming an image scroller which scroll through a set of images and stops after each one.

now i'm looking for an appropriate scrolling acceleration function. i'd like that the images first move quite fast and then slows down till the end.

i've experimented with sin(x)^2/x but it's very hard to find a well-looking function. are there any people around here who know some nice function for this?

also: is it better to have 40 ms intervalls with 10 px steps or 20 ms intervalls with 5 px steps? which one looks smoother? i guess i'm addressing the experienced users of you...

thx anyway

03-07-2005, 02:33 AM
I wrote an unusual function (http://www.codingforums.com/showthread.php?t=46379) for that sort of thing a while back... :D

03-07-2005, 01:00 PM
hehe nice stuff...

i did mine like this: y = a*x*Math.pow(e, -1/b*x), whereas e = 2.7182..

it runs quite smoothly

03-07-2005, 02:52 PM
nifty... :)

btw, several others are given here: Robert Penner's Easing Equations (http://www.robertpenner.com/easing/)

03-07-2005, 03:03 PM
drdre: 40 and 20 ms are both too low. Win9x provides a minimal guaranteed time frame of 55ms (WinNT provides a minimum frame of 10ms). Anything less than this will still be extended to 55ms or 10ms, respectively.