Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
cdedreuille

Animation from top of the page

Recommended Posts

Is there a way to trigger an animation at exactly 2000px from the top of the page while making sure that if you go back to the top, the animation reverse? I guess I'm describing a timeline animation attached to the scroll with a trigger at 2000px from the top of body.

 

I'm working on a Nextjs app so forwarding refs is not the ideal scenario.

Link to comment
Share on other sites

1 hour ago, cdedreuille said:

I'm working on a Nextjs app so forwarding refs is not the ideal scenario.

 

You have to work within the parameters of the framework you're working with. Have you looked at the selector util? Added in version 3.7.0.

 

See the Pen BaWOZpM by GreenSock (@GreenSock) on CodePen

 

1 hour ago, cdedreuille said:

Is there a way to trigger an animation at exactly 2000px from the top of the page?

So let's say top of body + 2000px.

 

Sure, that's what ScrollTrigger is for.

https://greensock.com/docs/v3/Plugins/ScrollTrigger

 

 

  • Like 1
Link to comment
Share on other sites

Ah I didn't know about selector. This doesn't solved my issue but that's a good one to know. I think I need to refactor my animation differently.

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.

×