Jump to content
Search Community

flip.getstate not taking the the parent div transform values in account

roshit121

Go to solution Solved by Rodrigo,

Recommended Posts

roshit121
Posted

i am trying to use flip animation to animate a child div whose parent has some transform property to it. when i initiate the animation, these transform values dont seem to get stored in the getstate, so the animation jumps and only starts to animate.

See the Pen XJjjRKY by RoshitShrestha (@RoshitShrestha) on CodePen.

  • Solution
Rodrigo
Posted

Hi,

 

There are two things that are causing the issue here:

  1. The card (red element) is the only one being changed here so there is no need to get the state of the parent as well, since the parent is not being flipped, just the card.
  2. One of the parent elements has a scale applied to it:
    .card-parent {
      transform: scale(0.8);
    }

    So you need to tell Flip that a scale is being applied otherwise things will look super weird. For that you can use the scale config option:
    https://gsap.com/docs/v3/Plugins/Flip/#scale

Here is a fork of your demo with those fixes:

See the Pen pvEEPMO by GreenSock (@GreenSock) on CodePen.

 

Is that what you're trying to achieve?

 

Hopefully this helps

Happy Tweening!

  • Like 2
roshit121
Posted

@Rodrigo Thanks! this is exactly what i was looking for.

  • Like 1

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