spritespin icon indicating copy to clipboard operation
spritespin copied to clipboard

Rotate on scrollwheel, but don't hijack scrollwheel

Open BenComicGraphics opened this issue 3 years ago • 5 comments

Basically, I want it to rorate while I'm scrolling down the page, the spritespin instance being fixed position on the page. How can this be acheived.

BenComicGraphics avatar Jul 22 '21 10:07 BenComicGraphics

to change the scroll axis you have to use the orientation option. For example

orientation: "vertical"

giniedp avatar Jul 22 '21 11:07 giniedp

sorry, didn't pay close attention to the question. You want to use the scroll wheel.

In that case, use the 'wheel' plugin, see example here

https://spritespin.ginie.eu/samples/#/input-wheel

giniedp avatar Jul 22 '21 11:07 giniedp

TRhat's... not what I asked at all.

I want to scroll down the page, with the cursor over the object, have the object rotate, but the page still scroll down.

BenComicGraphics avatar Jul 22 '21 11:07 BenComicGraphics

you probably need to implement a custom input module that listens to the scroll event and updates the frame number based on the scroll position. That will for sure work with mousewheel, touch scroll and more importantly the rotation will always be consistent with the scroll position.

Take a look at how the wheel plugin is implemented to get the idea https://github.com/giniedp/spritespin/blob/master/src/plugins/input-wheel.ts

giniedp avatar Jul 22 '21 13:07 giniedp

Here is an example on stackblitz

https://stackblitz.com/edit/spritespin-example-scroll?file=index.html

giniedp avatar Jul 22 '21 13:07 giniedp