Jump to content
Search Community

Calculate the distance from the top of the page before the animation fires

Desginer123 test
Moderator Tag

Recommended Posts

 

Hello, I have a question. I would like to calculate the distance from the start of the page scroll to the moment the animation fires. For instance:
 

const tl = gsap.timeline();
tl.to({}, {duration: 2})
tl.to({}, {duration: 2})
tl.to({}, {duration: 2}) -- calculate the distance from the start of the page to this animation
tl.to({}, {duration: 2})
tl.to({}, {duration: 2})
tl.to({}, {duration: 2})

I want to get range from start page to the moment when that animation starts and use this here: 

gsap.to(window, {scrollTo: {y: 'this distanse in pixels'},

 

Link to comment
Share on other sites

6 minutes ago, Cassie said:

Hi there! It's unclear from your question whether you're trying to scroll to a point in a scrollTriggered animation or if you're trying to scroll to an element with an animation attached to it.

Could you please link to a minimal demo on codepen to demonstrate? Thanks!

I'm sorry that I don't have a demo because I don't even know how it sounds right.
You are right, i trying to find a point in a scrollTriggered animation

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...