Jump to content
GreenSock

eranariel

Dragging and Dropping an SVG line

Go to solution Solved by Cassie,

Recommended Posts

Hi,  

I am new to gsap . 

How do I set the  SVG  to correspond with the path coordinates ? Extruding (drag/drop) the line/path to a new position is  constrained from view by the width and height of the <svg> . I would like to connect the line endings  (circle classes) to other elements as drag and drop. 

 

See the codepen link, and tons of thanks in advance! 

 

See the Pen mdmQOBX by aran-ariel (@aran-ariel) on CodePen

Link to comment
Share on other sites

Hi eranariel!

 

It looks like you're using an old version of GSAP. Please check out the Migration Guide.

 

You'll notice changes like this.

// old
element._gsTransform.x

// new
gsap.getProperty(element, "x")

 

After that, check out Draggable's docs and methods like hitTest.

 

  • Like 4
Link to comment
Share on other sites

On 8/7/2021 at 11:21 PM, OSUblake said:

/ old element._gsTransform.x // new gsap.getProperty(element, "x")

Blake,  

I have updated the code, however the line no longer appears . If I remove the TweenMax  script source,  the circles (endings) are no longer draggable, accordingly it is unclear where the code is referencing it.   If you could please have a look at the code, it would be greatly appreciated, thanks!

 

 

 

 

gsap3_revisions.html

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