Linear Scrolling with the scrollto function

377 views
Skip to first unread message

superjonbot

unread,
Aug 26, 2011, 12:58:12 PM8/26/11
to isc...@googlegroups.com
Hey guys, I was wondering if anyone has been able to remove the easing from the scrollto function. I'm trying to get it to scroll in a linear fashion but have been unsuccessful all morning.

I located the code to lines ~730,

now = (now - startTime) / step.time - 1;
easeOut = m.sqrt(1 - now * now);
newX = (step.x - startX) * easeOut + startX;
newY = (step.y - startY) * easeOut + startY;
that._pos(newX, newY);



Any ideas?   Thanks. -Jonathan

superjonbot

unread,
Aug 29, 2011, 10:41:02 AM8/29/11
to iScroll
anyone can help? :(

I basically need a linear progressing scrollto function

Thanks. -Jonathan

chinese web

unread,
Aug 29, 2011, 5:43:10 PM8/29/11
to isc...@googlegroups.com

I had the same problem and I just changed the following, and it seems to work fine for me. (Seriously I don't know why I am doing this, and it might be a big no-no!)


// now = (now - startTime) / step.time - 1;

// easeOut = m.sqrt(1 - now * now);

easeOut = (now - startTime) / step.time;

ish...@gmail.com

unread,
May 15, 2013, 6:11:38 PM5/15/13
to isc...@googlegroups.com
Works great for me as well, except it takes the easing off all the other iscrollers, making them go linear then stop immediately, without the nice ease to stop. This is perfect for scrolling through a lot of information slowly while a movie plays, but unfortunately takes away the "niceness" of iscroll. 

Perhaps there's a way to apply this on a case-by-case basis? Maybe only on a particular iscroller?

Cheers,

rjL

Matteo Spinelli

unread,
May 16, 2013, 7:09:25 AM5/16/13
to isc...@googlegroups.com
iScroll5 supports custom easing functions (and you can apply them on a case-by-case basic). iScroll4 doesn't.

Matteo
Reply all
Reply to author
Forward
0 new messages