Jump to content
Search Community

Animate different units of transform origin property

Sirisha Pendem test
Moderator Tag

Recommended Posts

Hi, I'm trying to implement the following effect from animista https://animista.net/play/entrances/slide-in-elliptic

Here the transform origin property changes from "50% 100%" to "50% 1400px"

But if I give the same values to gsap, the transform origin property remains at the initial value and doesn't change.

How do I animate a css property whose values differ in units?

 

Thanks in advance.

See the Pen rNMLryR by cjayanth95 (@cjayanth95) on CodePen

Link to comment
Share on other sites

Hey Sirisha. In cases like this to convert between units you should do the conversion yourself. In this case the 100% means 100% of the element's height. Also keep in mind that GSAP doesn't animate transformOrigin by default (because almost always this is not desired) so to do this effect exactly you should update the transformOrigin in the onUpdate. Here's one way to set it up:

See the Pen qBaNvvN?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 1
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...