Hi everybody,
some time ago I came up with nicer solution. I am not sure where the “formula” for the easing originates (maybe “ease and wizz”). But it is by far the most intuitive and flexible way to do it.
The expression doesn’t care how much dimensions you use and there there is no deciding between easeIn or easeOut.
“ratio” (between 0 and 1) interpolates smoothly where the easing is strongest – 0.5 gets you a symmetric curve.
“strength” defines how steep the curve can get. I recommend using something between 0.8 and 1 because this is where the “formula” shines & drops jaws.
And of course there is “dur”(-ation). 1 Second is a very good start!
start = [0,0];
end = [500,500];
ratio = 0;
steepness = 1;
dur = 1;
function expoOut (t,steepness){
if (steepness == 0) return x;
return (Math.exp(-steepness*t*7) - 1) / (Math.exp(-steepness*7) - 1);
}
function expoIn (t,steepness){
if (steepness == 0) return t;
return (Math.exp(steepness*t*7) - 1) / (Math.exp(steepness*7) - 1);
}
function expoInOut(t,ratio,steepness){
if (t <= ratio){
func = expoIn(linear(t,0,ratio,0,1),steepness);
return (func * ratio);
}
if (t > ratio){
func = expoOut(linear(t,ratio,1,0,1),steepness);
return (func*(1-ratio)+ratio);
}
}
t = linear(time - inPoint, 0, dur, 0, 1);
exp = expoInOut(t,ratio,steepness);
start + (end - start) * exp;