Jump to content
GreenSock

Willyakabi

How do I make those arrows always point to a target

Moderator Tag

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 guys ! I'm still learning how to make this animations and I'm still very newbie, and I having some trouble to structure my layout.

Spefically, those arrows in the image, it should always point to that word resposively. How can I do this?  

 

image.thumb.png.a717145666259e124a1ffbe00537926e.png

Link to comment
Share on other sites

HI and welcome to the GreenSock forums,

 

That's a pretty tough question. There really isn't anything in GSAP that is going to handle that for you. I suspect your best bet is to use SVG and re-draw a Bezier path based on the relative positioning of the circled word and the word with that the arrow points to. Performing those calculations could be quite a challenge from what I understand.

 

Do you have any of this in place in yet? Do you have a CodePen demo we could look at? Being that this is pretty far beyond the GSAP API, I'm really not sure how much help I can be but someone might have some suggestions. 

 

Please see the demos from @OSUblake at the end of this thread: 

They allow you to draw connecting lines between elements and then drag the elements around.  A bit similar to what you describe.  

Link to comment
Share on other sites

Wow, that was a quick response, yes I was reading that topic... And what I trying to figure it out is to set the position of  the nodes, can I set in  <span> or in a specific element position? 

See the Pen PJzwyW by willyakabi (@willyakabi) on CodePen

 

Link to comment
Share on other sites

Sorry, I'm really not sure how you would do that. It seems quite complicated to me.

  • Thanks 1
Link to comment
Share on other sites

Example of what I was talking about. It probably won't be easy to understand. I didn't add an arrow head, but you can do that using a marker.

 

See the Pen LzzjLw by osublake (@osublake) on CodePen

 

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

Thanks!

 

Preventing the path from intersecting with the words would make it a lot more complicated, so I just used a simple arc path. Here's a draggable demo showing it how it works.

 

See the Pen GMMyNo by osublake (@osublake) on CodePen

 

 

Link to comment
Share on other sites

Oh, I just noticed your fork. Good idea!

  • Thanks 1
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.
×