Jump to content
Search Community

Weird jump at end of tween with "expo.out" ease

jaden test
Moderator Tag

Recommended Posts

2 minutes ago, PointC said:

hmmm... Not sure what's causing that. @GreenSock will probably have to take a look. Here's the same thing using a custom ease. I just used the ease visualizer to pick expo and then switched to custom so i could copy the data. No other changes made to it.

 

 

See the Pen

See the Pen 19a3312f4763c4256a7a1a0b843992be by PointC (@PointC) on CodePen

by PointC (@PointC) on CodePen

 

Alright. I'm happy with other eases, just was wondering if I was doing something wrong :) 

Link to comment
Share on other sites

Yeah, that's just an anomaly due to the inherent inaccuracy of the math:

let easeIn = p => p ? 2 ** (10 * (p - 1)) : 0,
    easeOut = p => 1 - easeIn(1 - p),
    unsafeIn = p => 2 ** (10 * (p - 1)),
    unsafeOut = p => 1 - unsafeIn(1 - p);

console.log("safe:", easeOut(1), "vs unsafe:", unsafeOut(1)); // safe: 1 vs unsafe: 0.9990234375

It's essential that an easing function converts 1 (the completion value) to exactly 1, otherwise your animation won't quite reach the final values. Notice that first "easeIn" has some conditional logic to check if "p" is non-zero. There's the key. If we remove that, you'll get rid of the "jump" at the end, but you'll sacrifice accuracy because your end value won't be correct. See what I mean? 

 

My suggestion would be to avoid Expo. Power4 is almost the same anyway - I'd go with that. A CustomEase is fine too of course. 

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