Jump to content
Search Community

Counting down from 5 to 0 – proceed to next step

hallibus 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

Guys, thank you very much for your answers. 

 

 

15 hours ago, GreenSock said:

Good solutions, guys. You can use roundProps if you want the number rounded (or @PointC's toFixed() if you prefer). Here's a super-simple one: 

 

See the Pen 619e1802ce10452a468799708af05dc8 by GreenSock (@GreenSock) on CodePen

 

Or you could use a SteppedEase. Lots of options :)

 

 

 

Could you please explain the SteppedEase solution any further?

 

 

Thanks in advance!

Link to comment
Share on other sites

46 minutes ago, hallibus said:

Could you please explain the SteppedEase solution any further?

 

Check out what the SteppedEase does.

https://greensock.com/docs/Easing/SteppedEase

 

It changes a value in "steps". However, sometimes you need to be careful about that if you're expecting a certain value as there might be a floating point error.

 

For this particular demo, 2 ends up being 1.9999999999999996 for me. There's nothing you can do about that besides rounding, which brings you back to what Jack or PointC did. So SteppedEase might not be the best solution if you need to display the actual value.

 

See the Pen zJWVJY by osublake (@osublake) 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...