-
Penner easing expressions with layer slide
Hi all
I’d like to find a way to slide a layer into position based on it’s in point. Currently I am using this expression.
/* Legend:
t: current time
b: beginning value
c: change In value
d: duration
*/function easeInOutExpo (t, b, c, d) {
t /= d/2;
if (t < 1) return c/2 * Math.pow( 2, 10 * (t – 1) ) + b;
t–;
return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
};var xstartVal = 500;
var ystartVal = 500
var xendVal = 500;
var yendVal = 800;
var startDur = 0;
var endDur = 1.8;t = time – startDur;
d = endDur – startDur;y = easeInOutExpo (t,ystartVal, yendVal – ystartVal, d);
x = easeInOutExpo (t,xstartVal, xendVal – xstartVal, d);[x,y];
I’d like to be able to alter the ease velocity and looking a Robert Penner’s site I have tried to insert the easeOutQuint function but it failed spectacularly.
This was Penner’s easeOutQuint expression
public static float easeInOut (float t,float b , float c, float d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
}But it would be useful to be able to use any of his expressions.
Is there an easy way to do it?