Jump to content
Search Community

MotonPathPlugin problem. animation doesn't work correct on page resize.

Dzhuleikhan test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello everyone,

I have a little motionpath plugin problem on my website.

So if you scroll down to planets section, you will see that each planet moving through his own path.

The problem is, when i refresh the page on the same section planets position is not correct. I will provide screenshots.
Also, when i resize the page i have the same issue.

Is there any way to stick each planet to his own path? 
 

Thanks

983584003_Screenshot2023-02-11184758.png

82424096_afterrefresh.png

See the Pen QWBJgxX by juleykhan32 (@juleykhan32) on CodePen

Link to comment
Share on other sites

  • Solution

If you can't do what Cassie suggested, here's how you could handle it: 

See the Pen PoBMBXM?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Basically, put it all into a timeline, then when the screen resizes record the current progress, revert() the timeline, create a new one and populate it so that it can map all the new path positions, and skip to the recorded progress value. 

  • Like 4
Link to comment
Share on other sites

12 hours ago, GreenSock said:

If you can't do what Cassie suggested, here's how you could handle it: 

 

 

 

Basically, put it all into a timeline, then when the screen resizes record the current progress, revert() the timeline, create a new one and populate it so that it can map all the new path positions, and skip to the recorded progress value. 

Thank you so much for help.
Can you please show me how to fix an issue on page refreash?
So when i scroll down to planet section, and refreshing the page, planets chenge their positions.
I provided two screenshots normal position and position after page refreshed.

Thanks!

Link to comment
Share on other sites

12 hours ago, Dzhuleikhan said:

Can you please show me how to fix an issue on page refreash?
So when i scroll down to planet section, and refreshing the page, planets chenge their positions.

I'm not sure I understand - if you refresh the page, of course everything starts over. Are you saying you want to somehow record the state of things before the page gets refreshed, and then after it refreshes you want it to read that state and reposition things to match the progress of the animations before the refresh? If so, you'd need to record that in local storage (the progress value) and then read that back on page load and set the progress accordingly. 

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