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

Rotate on scrollwheel, but don't hijack scrollwheel #78

Open
BenComicGraphics opened this issue Jul 22, 2021 · 5 comments
Open

Rotate on scrollwheel, but don't hijack scrollwheel #78

BenComicGraphics opened this issue Jul 22, 2021 · 5 comments

Comments

@BenComicGraphics
Copy link

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.

@giniedp
Copy link
Owner

giniedp commented Jul 22, 2021

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

orientation: "vertical"

@giniedp
Copy link
Owner

giniedp commented Jul 22, 2021

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 giniedp closed this as completed Jul 22, 2021
@BenComicGraphics
Copy link
Author

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.

@giniedp
Copy link
Owner

giniedp commented Jul 22, 2021

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 giniedp reopened this Jul 22, 2021
@giniedp
Copy link
Owner

giniedp commented Jul 22, 2021

Here is an example on stackblitz

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

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