Jump to content
Search Community

ScrollSmoother & Threejs

Akamiaxx test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Hello,

 

I have a project with htlm images and I am creating a threejs plane per image and I am placing them using the img's getBoundingClientRect().

This part is working fine but the problem is when I try to have the scrollsmoother on both my html page and my threejs scene, in sync with ScrollSmoother.

By offseting the position of my elements by the window.scrollY this is working fine but obvioulsy I dont get the smoothness from ScrollSmoother, and when I am trying to do scrollsmoother.progress * window.scrollY I am expecting to have to correct position but this is not working.

 

This is how I am calculating the position of my mesh. 

image.png.ce6d607f680208b6ab73f701539b4cd1.png

 

This is my ScrollSmoother instance
image.png.5cb7c039ca13245642b4fbc68c022fde.png

 

Here is a preview with an offset with window.scrollY & another with window.scrollY * scrollsmoother.progress.

https://drive.google.com/drive/folders/17n9zVM2ROEEFZxx_-1r67aqoory8sdTm?usp=sharing

 

Thank you!

 

Link to comment
Share on other sites

Sorry I can't create one right now, but I am trying to get the scroll position in pixels from scrollsmoother. Do you have any idea of how I can get that ?

Since scrollsmoother doesnt provide that I was thinking about : scrollsmoother.progress * window.scrollY.

Any thoughts ?

Link to comment
Share on other sites

  • Solution

 

12 minutes ago, Akamiaxx said:

I am trying to get the scroll position in pixels from scrollsmoother. [...] Since scrollsmoother doesnt provide that [...]

 

Hello @Akamiaxx

 

Actually, I think it does provide that.

https://greensock.com/docs/v3/Plugins/ScrollSmoother/scrollTop()

 

See the Pen wvjyreq by akapowl (@akapowl) on CodePen

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...