New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mass and momentum #427
Comments
You can use the |
Yeah I tired several options- if I go super low 0.07 even down to 0.04 (which feels close to ios), I it feels very smooth but it's super jumpy. If I go higher with damping it's super stiff. Mass would do the magic here. |
(Not sure momentum is a proper word here, although people are calling it "momentum-based scrolling".) As mass directly proportional to momentum, you can use the following plugin to multiply the momentum when releasing finger: import Scrollbar, { ScrollbarPlugin } from 'smooth-scrollbar';
import OverscrollPlugin from 'smooth-scrollbar/plugins/overscroll'; // if you are using this
class MassPlugin extends ScrollbarPlugin {
static pluginName = 'mass';
static defaultOptions = {
m: 1.0,
};
override transformDelta(delta: { x: number, y: number }, fromEvent: Event): { x: number, y: number } {
if (fromEvent.type === 'touchend') {
return {
x: delta.x * this.options.m,
y: delta.y * this.options.m,
};
}
return delta;
}
}
Scrollbar.use(MassPlugin, OverscrollPlugin);
Scrollbar.init(elem, {
plugin: {
mass: { m: 1.5 },
},
}); |
I just tweaked some calculations to make the touch scrolling more natural, especially with |
Is it live on your demo page?
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Daofeng Wu ***@***.***>
Sent: Friday, December 24, 2021 11:32:00 AM
To: idiotWu/smooth-scrollbar ***@***.***>
Cc: Tony Beretini ***@***.***>; Author ***@***.***>
Subject: Re: [idiotWu/smooth-scrollbar] Mass and momentum (Issue #427)
I just tweaked some calculations to make the touch scrolling more natural, especially with damping: 0.05 on mobile devices. Can you update to v8.7.1<https://github.com/idiotWu/smooth-scrollbar/releases/tag/v8.7.1> to give it a try?
—
Reply to this email directly, view it on GitHub<#427 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APUUMIBXHCW2E24IDWXJYFDUSSVBBANCNFSM5KV5LMUA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Yeah, but I didn't add the |
I just noticed that scroll is jittering after this update while slowing down |
Have you unchecked the |
Yes
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Daofeng Wu ***@***.***>
Sent: Saturday, December 25, 2021 11:36:12 AM
To: idiotWu/smooth-scrollbar ***@***.***>
Cc: Tony Beretini ***@***.***>; Author ***@***.***>
Subject: Re: [idiotWu/smooth-scrollbar] Mass and momentum (Issue #427)
I just noticed that scroll is jittering after this update while slowing down
Have you unchecked the renderByPixels option?
—
Reply to this email directly, view it on GitHub<#427 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APUUMIFBOC2Z63B5SM5XUFLUSX6IZANCNFSM5KV5LMUA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
It behaves smoothly in my environments (MacBook Pro 13, 2019; Pixel 4 w/ Android 12). Maybe |
Could be - I i don't think this was the case in the last version. I could be wrong ... Google Pixel 6 Pro here and iPhone 12 Pro MAX
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Daofeng Wu ***@***.***>
Sent: Saturday, December 25, 2021 11:40:19 AM
To: idiotWu/smooth-scrollbar ***@***.***>
Cc: Tony Beretini ***@***.***>; Author ***@***.***>
Subject: Re: [idiotWu/smooth-scrollbar] Mass and momentum (Issue #427)
It behaves smoothly in my environments (MacBook Pro 13, 2019; Pixel 4 w/ Android 12). Maybe damping: 0.02 brings too many frames that slow down the rendering?
—
Reply to this email directly, view it on GitHub<#427 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APUUMIBPJQPT5SYI3NUJAVDUSX6YHANCNFSM5KV5LMUA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Is it possible to control mass and momentum? I feel that with a bit more mass and momentum, the scroll would feel more natural. For instance comparing it to iOS native scroll, on shorter swipes, scroll moves longer and it eases out before it stops.
The text was updated successfully, but these errors were encountered: