Jump to content
Search Community

Animate to auto value using only ".to" with function

Visual-Q test
Moderator Tag

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

This follows the recent thread  'Animating height percent'

Jack came up with a great solution using a function for animating to an auto value. In the original, he showed it using a  fromTo but what I thought was of particular note was that it can work using just a to tween. 

 

I thought it was worth promoting to it's own thread to make it easier to find as we see periodic questions about how to animate to an 'auto' value. I think this pen does a reasonable job of illustrating it.

 

See the Pen rRdrZR by Visual-Q (@Visual-Q) 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.
×
×
  • Create New...