Jump to content
Search Community

Inertia plugin: Move more than one element at the same time

Vander test
Moderator Tag

Recommended Posts

Hi there!

 

I've searching for some information about inertia plugin and if it would be possible to move more than one element at the same time and found nothing :/ The idea was to select some elements (for example with cmd+click) and then grab them and move them at the same time.

 

In the codepen above i've made an example with hexagons(open it in codepen/new tab for better performance), you should click on the left list to add some of them...

 

Could this be achieved with gsap and intertia plugin?

 

 

Many thanks

See the Pen bGrPyOJ by EricCV (@EricCV) on CodePen

Link to comment
Share on other sites

I assume you meant Draggable, not InertiaPlugin, right? InertiaPlugin is for smoothly tracking and continuing (and gradually stopping) the inertia of any property of any object. It looks like you just want to make things draggable...right? 

 

And yes, you could technically accomplish something like that (a multiple-select-and-drag) with custom code. Like maintain an Array of the selected items and their starting x/y values and then on the most recently-pressed one that actually has the dragging occurring, just loop through the others and apply the delta to those. There's another technique that may work as well, but I don't want to overwhelm you with options. 

 

I'd suggest giving it a try with a VERY simple demo and then if you get stuck, post a minimal demo and we'd be happy to take a peek and answer any GSAP-specific questions. 

Link to comment
Share on other sites

10 hours ago, GreenSock said:

I assume you meant Draggable, not InertiaPlugin, right? InertiaPlugin is for smoothly tracking and continuing (and gradually stopping) the inertia of any property of any object. It looks like you just want to make things draggable...right? 

 

And yes, you could technically accomplish something like that (a multiple-select-and-drag) with custom code. Like maintain an Array of the selected items and their starting x/y values and then on the most recently-pressed one that actually has the dragging occurring, just loop through the others and apply the delta to those. There's another technique that may work as well, but I don't want to overwhelm you with options. 

 

I'd suggest giving it a try with a VERY simple demo and then if you get stuck, post a minimal demo and we'd be happy to take a peek and answer any GSAP-specific questions. 

Hi Jack,

 

yes, i wanted to say Draggable but I was distracted and wrote InertiaPlugin haha 

 

I'll try what you say :)

Thanks

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