Jump to content
Search Community

Drag & bezier curve

jeremyp test
Moderator Tag

Go to solution Solved by Rodrigo,

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

Hi,

 

I have two questions, i've already some kinds of solutions, but I would to know if you have some ideas about it : 

 

first, I would to know if I can easily combine drag and bezier : I mean, drag an object along a bezier curve using drag & bezier plugins?

 

My current idea is to create a timeline with my object animated along the curve, stop this animation, and control the timeline with a simple horyzontal drag in the bounds box of the curve. Do you see what I mean ?

 

Then, I would to be able to draw the curve ( dotted.. but it's another problem ), do you have any ideas of how I can convert my bezier coordinates to use canvas's method quadraticCurveTo() for example ?

 

Let me know if you have any suggestions, advices.. 

 

Thanks :) !

post-32228-0-69359000-1412796229_thumb.jpg

Link to comment
Share on other sites

  • Solution

Hi Jeremy and welcome to the GreenSock forums.

 

This codepen shows how you can translate the progress of a tween/timeline using Draggable:

 

See the Pen Batoc by rhernando (@rhernando) on CodePen

 

Then you can easily add the trigger property to the mix in order to use a parent bounding box to... well trigger the Draggable instance ;)

 

See the Pen IiHgq?editors=001 by rhernando (@rhernando) on CodePen

 

Hopefully those codepens combined can come in handy.

 

Let us know if you need more assistance.

 

Rodrigo.

  • Like 3
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...