Jump to content

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

Is easing functions accessible for other operations than DOM manipulation?

Recommended Posts

Hi everyone,


I was about to implement something like this in my current project, but I guess the GSAP codebase already have it, is it accessible for something else than DOM manipulation?


See the Pen XWrjJVN by yyy589 (@yyy589) on CodePen

Link to post
Share on other sites
45 minutes ago, Alexis_G said:

is it accessible for something else than DOM manipulation?


At its core, GSAP doesn't do DOM manipulation. That's what the CSSPlugin does, so yes, you can use the easing functions for whatever you want. Every ease has a .getRatio() method, where you pass in a normalized value from 0 to 1.


var ratio = Power1.easeIn.getRatio(0.5);


Check out this post where I use different easings to plot points for sine waves.



If you need help normalizing a value, here's a little helper function. Just pass in the current, min, and max values.


// normalize will return a value between 0 and 1
function normalize(value, min, max) {
  return (value - min) / (max - min);


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

  • Recently Browsing   0 members

    No registered users viewing this page.