Skip to content
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

Set friction? #16

Open
rvanderspuy opened this issue Jan 30, 2020 · 3 comments
Open

Set friction? #16

rvanderspuy opened this issue Jan 30, 2020 · 3 comments

Comments

@rvanderspuy
Copy link

Hello!

I've had a request by client to increase the amount of friction on the scroll effect, so that it slows down sooner. Is there a publicly accessible API call to do this?

@davidfig
Copy link
Owner

davidfig commented Jan 31, 2020

Yup. pixi-scrollbox uses pixi-viewport for its innerworkings. The scrollbox.content gives you access to the viewport. You would need to change the decelerate options (https://davidfig.github.io/pixi-viewport/jsdoc/) to increase friction. Something like: scrollbox.content.decelerate({ friction: 1.25 }). Lots of options to play with to get the feel your client wants.

@rvanderspuy
Copy link
Author

@davidfig Thanks, that worked perfectly! Also, thanks so much for your quick reply and beautifully maintained repo!

@rvanderspuy
Copy link
Author

@davidfig ...Oops, it looks like I spoke too soon! (turns out I was testing press-and-drag, not single finger scroll on touch devices.) I tried a few values like scrollbox.content.decelerate({ friction: 0.6 }) but there is seemingly no effect. tried setting the friction values directly, but it does't seem to be a property of scrollbox.content.options. Do you have any idea what I might be doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants