Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
DAVD

Directly accessing /using ease functions

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

Is there a way to directly use the penner easing functions (and other) included in GSAP?

 

I run my own update loop (on Scroll) and just want to pass my values through the easing functions to make everything a tiny bit more awesome.

 

Example of what I would like to do. passing in p (value of 0 to 1) start value 0, change value 1, and duration 1.

Power2.easeInOut(p,0,1,1);

right now I define the functions again in my code like this:

 

var easeInSine = function (t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
}
easeInSine(p,0,1,1);

would be great to hook into the greatness of Greensock instead of defining them again.

 

I'm using the latest js and tweenmax.

Share this post


Link to post
Share on other sites

Like this...

var progress = 0.5;
var value = Power2.easeInOut.getRatio(progress);
  • Like 6

Share this post


Link to post
Share on other sites

Yep, Blake is exactly right. If you're trying to use it kinda like the Penner ones, here's a long-winded way that shows how it'd work:

var start = 0;
var end = 200;
var time = 1.5;
var duration = 3;

var calculatedValue = start + Power2.easeInOut.getRatio(time / duration) * (end - start);
  • Like 2

Share this post


Link to post
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

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. 


  • Recently Browsing   0 members

    No registered users viewing this page.

×