Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
drewbit

Tweening along a defined path

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

If I have a set number of coordinates, say a user draws an s-curve with their mouse/finger, what would be the best way to tween an object along the same path?

 

I can loop a bunch to TweenTo calls but I'm wondering if there is a better way? A plugin maybe that helps with this?

 

Thanks for any suggestions. 

Link to comment
Share on other sites

Hello drewbit, Welcome to the GreenSock Forums!

 

Have you looked into the Bezier Plugin?

 

Bezier Plugin Docs:

http://api.greensock.com/js/com/greensock/plugins/BezierPlugin.html

 

Animate virtually any property (or properties) along a curved Bezier path which you define as an array of points/values that can be interpreted 4 different ways (described as the Bezier's "type", like type:"soft"): "thru" (the default) - the plugin figures out how to draw the Bezier naturally through the supplied values using a proprietary algorithm.

 

GreenSock BezierPlugin examples:

See the Pen ABkdL by GreenSock (@GreenSock) on CodePen

See the Pen Kajpu by GreenSock (@GreenSock) on CodePen

 

:)

  • Like 3
Link to comment
Share on other sites

Exactly what I was after! thank you very much.

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