Vadym S. Posted October 10, 2023 Share Posted October 10, 2023 Hi, can you please adwise how I can make relative animation so object enlessly moves in specific direction on some step relatively to it current position. Start: box (x=0 y=0) iteration 1: 1s animation box (x=100 y=0) iteration 2: 1s animation box (x=200, y =0) iteration 3: 1s animation box (x=200, y =0) and so on and so on.. I don't have end point, I don't have a total time ofr animation, but I know that obkect has to move 100px during 1s. Link to comment Share on other sites More sharing options...
mvaneijgen Posted October 10, 2023 Share Posted October 10, 2023 You can set a relative position using x: '+=100', which will move the element 100px from the current position. If you need further assistance, please provide a minimal demo with your setup so that we can take a better look at it. Hope it helps and happy tweening! Link to comment Share on other sites More sharing options...
Vadym S. Posted October 10, 2023 Author Share Posted October 10, 2023 See the Pen GRPzydj by twtracer (@twtracer) on CodePen I don't need it to repeat from the beginning. it has to go from 100px to 200px, then from 200px to 300px, etc like this: https://share.zight.com/GGuy2RLq Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted October 10, 2023 Solution Share Posted October 10, 2023 Your timeline gets to be infinite or your tween does, but they can't be both infinite. I've set repeatRefresh: true, and repeatDelay: 1, to the timeline, it will now recalculate the distance on each repeat and pauses for 1 second between those. Hope it helps and happy tweening! See the Pen ZEVwrYP?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen 2 Link to comment Share on other sites More sharing options...
Vadym S. Posted October 10, 2023 Author Share Posted October 10, 2023 Yes, perfecto. Thank you 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