Jump to content
GreenSock

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

Animate position inside a vertically centered div

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,

 

Each time I click on the button, I add a new (.box) in the list but I want to smooth the position of the others boxes (see my codepen) and still get the content vertically centered. 

 

As you can see I used flexbox.

 

Thanks for the reply.

See the Pen gRvYGe by anon (@anon) on CodePen

Link to comment
Share on other sites

Hello @jords and welcome to the GreenSock forum!

 

Are you talking about before each box animates in, You want the previous added box to animate up and then fade in the newly added box?

 

Any additional info on exactly how you want this to animate will be greatly appreciated so we understand what type of effect you are going after.

 

Thanks! :)

  • Like 2
Link to comment
Share on other sites

@Jonathan So, what I want to do is move the old box so they are vertically centered no matter how much boxes there are. Basically I want to do the same thing the pen already does but I want to ease the movment of the div so it's not recalculating the position with flexbox.

 

I linked a picture so you can understand better.

Desktop.png

Link to comment
Share on other sites

I'm not really up to speed on how to override flex-box's auto-repositioning of things while animating with GSAP.

However, @OSUblake was kind enough to provide some detailed information and demos.

 

Please read:

 

 

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