Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ease Out Cubic - Function Arguments Explanation

On this great web page I found a list of easing algorithms that can add nice visual appeal to my webpages.

Despite, I found there brief mention of the function arguments (see below), the algorithm does not behave as I would wish. Can I kindly ask for explanation on what values/ranges should be entered into the arguments of the function below mentioned?

Argument list:

  • t: current time - should here be values 0...1, or real number of the current frame?
  • b: start value - I assume, a start X or Y coordinate of the object being moved
  • c: change in value - can here be number 1 all the time for all the frames?
  • d: duration - the number of frames altogether?


Math.easeOutCubic = function (t, b, c, d) {
    t /= d;
    t--;
    return c*(t*t*t + 1) + b;
};

Should the values be incrementally added to the last value obtained from the function, or should they be added to the initial 0 position?

like image 771
Bunkai.Satori Avatar asked Apr 16 '12 09:04

Bunkai.Satori


1 Answers

You're right, d is for duration and t is current time. Therefore, t should be from 0 to d.

c is a total change, should be equal to end value - start value.

  • For t = 0 we have c*(-1 + 1) + b or b
  • For t = d we have c*(0 + 1) + b or b + c

Function would be the same for any fps, it's up to you how frequently update position and call the function.

like image 113
kirilloid Avatar answered Oct 28 '22 08:10

kirilloid