pixi-scrollbox icon indicating copy to clipboard operation
pixi-scrollbox copied to clipboard

Set friction?

Open rvanderspuy opened this issue 5 years ago • 3 comments

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?

rvanderspuy avatar Jan 30 '20 13:01 rvanderspuy

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.

davidfig avatar Jan 31 '20 00:01 davidfig

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

rvanderspuy avatar Jan 31 '20 09:01 rvanderspuy

@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?

rvanderspuy avatar Feb 03 '20 10:02 rvanderspuy