Jump to content
Search Community

GSAP Tween ease does not accept a function

trusty97 test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

It appears as though the ease property does not accept a function returning a default ease string (such as 'power4.out' ) as a value. I know there is language around it accepting a "function that accepts a progress value between 0 and 1 and returns a converted, similarly normalized value" but it'd be great if I could use a function to return a preset easing value based on some condition in the browser (such as resizing the window). 

 

Condition: 
 

gsap.to(el, {
...
ease: () => (condition ? 'power4.out' : 'none',
...
}

Expected:
Preset easing value set based on ternary function. 

 

Result: 

GSAP tween breaks and no longer works.

 

I've included a codepen that demonstrates this not working. Is there any way to do this? Any thoughts here are greatly appreciated! 

See the Pen GRQpRKW by pdnellius (@pdnellius) on CodePen

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