Jump to content
GreenSock

quintonjason

Shuffle Grid

Go to solution Solved by OSUblake,

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

Hello GSAP Masters!

 

I'm trying to replicate the 'submit' button functionality. I don't want to empty the parent container before the shuffle occurs. I'm trying to have them shift from the current position to the next position. 

 

Can someone point me in the right direction?

See the Pen BNxoZa?editors=011 by iota (@iota) on CodePen

Link to comment
Share on other sites

Hi quintonjason :)

 

i think it's what Blake can handle better than me :)

 

anyway you can record previous position and the define a fromTo tween after appending , something like this : 

 

See the Pen WQWJPV by MAW (@MAW) on CodePen

  • Like 2
Link to comment
Share on other sites

  • Solution

Kind of strange. That demo is obviously based off of my sortable grid, but it doesn't use a single line of code from it. Even the CSS is completely different.

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

 

Like Diaco said, just create a fromTo animation. The grid is setup using floated elements, so you can use relative animations, which lets the browser calculate the layout. All you have to do is offset it from it's old position and then animate it to 0. Here's an example of a relative animation.

See the Pen QjQGBa?editors=001 by osublake (@osublake) on CodePen

 

Apply that technique to that demo and it looks pretty good! It works with the reorder too.

See the Pen wMJeRb?editors=001 by osublake (@osublake) on CodePen

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