Share Posted November 6, 2022 Hello, I am currently trying to apply a simple translate animation between two points however, instead of taking a straight line I want it to take a curved path. For example, given the image below I want to move the item from A to B taking a curved path through the point C (A to C and C to B are mirrored if it simplifies things) I was just wondering if this is possible to achieve this using gsap? Any help is greatly appreciated, thank you! Link to comment Share on other sites More sharing options...
Solution Solution Share Posted November 6, 2022 Of course! That's what MotionPathPlugin is for. Or you could "fake" it by using two tweens with different eases - the vertical ("y") tween could use an "out" ease like "power1.out" and the horizontal ("x") tween could use ease: "none", but that will obviously affect the overall motion/pace of the target. So MotionPathPlugin gives you by far the most flexibility. A 3rd option is to use Math.cos() and Math.sin() to plot the interpolated x/y coordinates if the curve is just the outer edge of a true circle. Lots of options Enjoy! 1 Link to comment Share on other sites More sharing options...
Author Share Posted November 6, 2022 Just took a look at the MotionPathPlugin docs and I think this is what I'm looking for, am going to give it a go Thank you so much! 1 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