Jump to content
Search Community

Sorting animation, and height on making visible...

folktrash test
Moderator Tag

Go to solution Solved by folktrash,

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

I've got a list of items. Filters are clickable that hide all but the items in that category with a sequence that fade opacity and height to 0. When showing all, items currently at opacity and height 0, fade in correctly, but height "pops" in immediately.

 

Am I missing something obvious here? Also, is there a more appropriate place to post than here? SO perhaps?

Link to comment
Share on other sites

  • Solution

TL;DR: when implementing hide and show animation use-cases involving height going to 0: you'll need to switch to from() tweens on the show condition, which means you'll need to perform a set() of the properties you're "from'ing" right before you from() them. 

 

In my case, I was going to height:0, opacity:0, so on "show" I needed to set() opacity:1, height:1, and then from() height:0, opacity:0

 

While this may seem strange, it's less complicated than calc'ing heights of each items and animating to that specific value.

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