ginphreak Posted December 14, 2023 Share Posted December 14, 2023 Hi forum, i have a stupid question, bu i spend much time on it: i want to move a fixed div (a simple square div) on page from center to right and from right to left. But with this code second .to() starts from center and not from last position. Ho can i start from last position? Thank you and sorry for the stupid question. See the Pen jOdjOZW by gmanzavinoilabsolutionsit (@gmanzavinoilabsolutionsit) on CodePen Link to comment Share on other sites More sharing options...
mvaneijgen Posted December 14, 2023 Share Posted December 14, 2023 Don't worry about asking any type of question here. We're here to help each other and we all have to start somewhere! There is a logic issue here. A tween on a timeline can not have its own ScrollTrigger only the whole timeline can be controlled by the ScrollTrigger, not individual parts. Here is your same logic, but combined in to one ScrollTrigger. Its start trigger is your first section and its end trigger is the second section. Hope it helps and happy tweening! See the Pen jOdjEGG?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen 3 Link to comment Share on other sites More sharing options...
ginphreak Posted December 14, 2023 Author Share Posted December 14, 2023 Thank you mvaneijgen but i have to repeat this alternate mouvement for all sections an this solutions (i think) is valid only for 2 sections. Or not? Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted December 14, 2023 Solution Share Posted December 14, 2023 Nope, you can do it as much as you like See the Pen PoVrqjQ?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen 2 Link to comment Share on other sites More sharing options...
ginphreak Posted December 14, 2023 Author Share Posted December 14, 2023 Thank you very much!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now