Jump to content

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

Drag & copy use GSAP Draggable

Recommended Posts

Hi and welcome to the GreenSock forums.


Thanks for the codepen, it illustrated what you're after.


The first thing that came to my mind was this codepen I made some time ago:


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


But it seems that you're after a scenario a bit more specific, but basically the concept is somehow similar. I crafted this new pen that keeps adding a new cloned element to the parent:


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


Please feel free to fork and adapt it to your needs. I'm not completely sure though of how many elements you might want to add, so this sample is kind of the battery bunny of Drag & Copy, you can keep going and going and going :D. If you want to add just one, simply remove the Draggable.create() method from the onPress function.



  • Like 3
Link to comment
Share on other sites

HI and welcome to the GreenSock forums,


Thanks for the demo. It definitely helps describe what you want to do.

We don't have a lot of time for coding custom solutions like that, but our moderators have done some similar things that should certainly help get you started.



Superstar Rodrigo:

basic Drag and clone


move from one container to another: http://codepen.io/rhernando/pen/LEyLxp

 -- however Draggable now has hitTest() built in: http://codepen.io/GreenSock/pen/Pqwxvw



Craziness by Blake:


  • Like 2
Link to comment
Share on other sites

You see, Rodrigo is so good he beat me to it :)

Link to comment
Share on other sites

Rodrigo is awesome! A similar question came up a couple months ago, and used his example as a starting point for creating that demo. 

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