Jump to content
Search Community

Drag & copy use GSAP Draggable

Aosdin test
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 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.

 

Rodrigo.

  • 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

http://codepen.io/rhernando/pen/Jlfsq?editors=001

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:

http://codepen.io/osublake/pen/dPEbey

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