Jump to content
Search Community

MotionPath + Scroll Trigger

dzestis94 test
Moderator Tag

Recommended Posts

 

Hey there @dzestis94

 

59 minutes ago, dzestis94 said:

For some reason my element stops  when it reaches second section....

 

Your element has position: absolute so if you tween it down 100vh like you did, it will tween into your second section. It would need to be position: fixed for it to behave like what you probably expected as the outcome with the values you set for the path.

 

Also, since you have set the end of all your ScrollTriggers to an absolute value of 100 via defaults, it would only scrub over the distance of 100px (from scroll-position 0 to 100) and that's probably not what you want either.

 

I'm not sure if this is what you had in mind, but here's an example for how you could go about it. I kept the position of the element absolute, but changed the values of the path and the end of the ScrollTrigger instead, to match that absolute position of the element.

 

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

 

  • Like 5
Link to comment
Share on other sites

Okay, thank you for this example, but by any chance is it possible to set 'end' height which depends of how many sections are on the page? Because I would like to use the same animation on separate pages. And some pages has 10 section and some only 3. So it adds extra blank space below foote... 

Link to comment
Share on other sites

@GreenSock Thank you for this example! This is almost what I want to achieve!  One thing, I won't use data-attributes, because I have created dinamically sections with ACF on Wordpress. 

And here is updated my pen 

See the Pen gOzELQm by dzestis94 (@dzestis94) on CodePen

 with timeline animation which should play only on first section. How I could stop that animation when I reach second section, and  start ScrollTrigger from that point where animation stopped, but in the same way have the same path? 
 

Link to comment
Share on other sites

Let me clarify. So let say I have timeline animation where my element moves from side to side by custom path. But that animation runs only on first section.  When I reach second section,  animation stops and my element starts trigger by scroll from that point where animation stopped on first section. But motion path which starts from second section will be the same all the time. I hope it make sense now :)

Link to comment
Share on other sites

Sorry, I'm pretty lost. It sounds like a logical impossibility if you want the first animation to run and then the element picks up from wherever that happens to be at scroll-time...AND you want it to always be exactly the same. It can't be dynamic (wherever it is when the user starts scrolling) AND ALSO exactly the same every time. 🤷‍♂️

Link to comment
Share on other sites

Sorry if I couldn't explain it properly. 

So at the end I decided to have an element which appears from section no.2 and then moves along all the rest of sections through the page on ScrollTrigger by motion path. Ideally opacity 0 would be set at the start and then in a middle of section 2 it changes to 0.5. Is it achievable? 

And is there any chance to refuse data atrribute for x property? 

Link to comment
Share on other sites

Hi,

10 hours ago, dzestis94 said:

So at the end I decided to have an element which appears from section no.2 and then moves along all the rest of sections through the page on ScrollTrigger by motion path. Ideally opacity 0 would be set at the start and then in a middle of section 2 it changes to 0.5. Is it achievable? 

Can you provide a minimal demo of this approach? 

 

10 hours ago, dzestis94 said:

And is there any chance to refuse data atrribute for x property? 

You can get your data from anywhere you want, but at the end if you want a dynamic sections amount, you'll also need a dynamic way to get the data for each specific section and most important a way to set that data so you can get it in JS and then pass it to GSAP.

 

I believe there are ways in Wordpress to do that, probaly shortcodes or something of the sorts, but my knowledge of Wordpress is very limited.

 

Happy Tweening!

Link to comment
Share on other sites

Hey @Rodrigo
Thank you for your response. Yeah I can share my demo: 

See the Pen MWGxqdv by dzestis94 (@dzestis94) on CodePen


 

So I have a path which I created with MotionPath helper. Which starts from second section.

I'm stuck now for a while and I can't find a way how to track the ball in the center of the screen. Because now on some sections it moves too fast and it disappears from viewport.  Ideally I would like to stop the ball before footer, that means always on last section.

Also it's not responsive either. On my big screen it's fine, but on my iMac mini pro, the ball leaves the path.... 

 

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