View Full Version : Modify scroll animation

15 Sep 2011, 3:51 AM
Is it possible to add more / less easing to the standard Sencha scroll animation? If so, any idea how?


15 Sep 2011, 4:47 AM
Hi Ayame.
I suggest you to take a look at the Ext.util.Scroller component doc:


As you can see there are some config params you can "play" with (accelleration, friction, etc.) to make the scroller acts like you want.
So, if you want to changes this params for every Sencha component that use the scroller, you should ovveride the default params in this way:

Ext.override(Ext.util.Scroller, {
accelleration: 50,
friction: 0.2

Hope this helps.

15 Sep 2011, 4:56 AM
That does indeed seem to point me in the right direction, I'll give that a shot, thanks!

One more thing: can I invoke scrolling upon the click of a button? In jQuery there's a .scrollTo() function, is there something similar in Sencha but then on the x axis as well instead of just the y?


15 Sep 2011, 5:06 AM
Suppose you have a vertical scrollable Ext.Panel defined inside a "pnl" variable.
To scroll the panel to the top, just write

pnl.scroller.scrollTo({x:0, y:0}, true);

the first param is an Object that accept the new coordinates, and the second param (in this case true) say if the scroller has to be animated to reach his new position.

Hope this helps.

15 Sep 2011, 5:13 AM
Superb! Thanks