pixi-scrollbox
pixi-scrollbox copied to clipboard
Set friction?
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?
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 Thanks, that worked perfectly! Also, thanks so much for your quick reply and beautifully maintained repo!
@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?