I have an elastic ease out function, formula in code:

float easeOutElastic(float t, float b, float c, float d) {
    float ts = (t/=d) * t;
    float tc = ts*t;
    return b+c*(33*tc*ts + -106*ts*ts + 126*tc + -67*ts + 15*t);

Taken from here, the elastic out small variant: http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm

I'm trying to modify the function so that the start and end values are equivalent. Essentially the red line.

enter image description here

I am not sure which of the parameters to modify to achieve this. Is anyone familiar with this particular easing function that could provide some guidance?

My goal is to use this function on the scaleY param of a rectangle I'm animating. I think this would provide a nice stretch/squash animation, where the rectangle returns to its original size at the end of the animation.

Thank you


1 Answer 1


You can do following (in pseudocode):

if (x < threshold)
    return std::max(1, easeOutElastic(...));
    return easeOutElastic(...);

In this code, threshold means any value between X positions of two first intersections of Y=1 and easeOutElastic(...). (Thus, the minimal value is equal to length of the red line.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .