ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Combining inPoint and outPoint Position Ease

FAQ   •   VIEW ALL Combining inPoint and outPoint Position Ease on Feb 21, 2020 at 6:47:07 pm

Hello,

I found this inPoint position ease expression from one of the threads, please is there any way I can modify the expression for both inPoint and outPoint ease?

Regards,

Obed

```EaseIn = function(power){return function(t){return Math.pow(t, power)}}; EaseOut = function(power){return function(t){return 1 - Math.abs(Math.pow(t-1, power))}}; EaseInOut = function(power){return function(t){return t &lt; 0.5 ? EaseIn(power)(t*2)/2 : EaseOut(power)(t*2 - 1)/2+0.5}}; dur=1; power=5; //1=linear, 2=Quad, 3=Cubic, 4=Quart, 5=Quint startX= 3000; startY=-3000; endX= 960 ; endY= 540 ; t=ease(time-inPoint,0,dur,0,1); Exp=EaseInOut(power)(t); x=startX+(endX-startX)*Exp; y=startY+(endY-startY)*Exp; [x,y]``` Re: Combining inPoint and outPoint Position Easeon Feb 21, 2020 at 7:50:42 pm

That code is neat that it can invert the function based on the power being input, but honestly it seems pretty clunky to try and modify. Here is what you're looking for, re-written into something more AE friendly that functions similar to the existing linear/ease functions.

Note that all that I do is check if the time is closer to the in or out point, and then invert the function. Really easy.

```function easeInOutQuint(t, tMin, tMax, value1, value2){ b = value1; c = value2-b; d = tMax-tMin; t = tMin &lt; tMax ? thisLayer.linear(t,tMin,tMax,0,d) : thisLayer.linear(t,tMin,tMax,d,0); t /= d/2; if (t &lt; 1) return c/2*Math.pow(t,5) + b; t -= 2; return c/2*(Math.pow(t,5) + 2) + b; } duration = 1; start=[3000,-3000]; destination = [960,540]; exit = [-3000,3000]; middle = (inPoint+outPoint)/2; v = time &lt; middle ? easeInOutQuint(time,inPoint,inPoint+duration,start,destination) : easeInOutQuint(time,outPoint-duration,outPoint,destination,exit);```

Alex Printz
Mograph Designer Re: Combining inPoint and outPoint Position Easeon Feb 21, 2020 at 8:06:29 pm

Hello Alex,

Thanks for the reply. Unfortunately, I am told there is are error inline 8. I would be glad if you could take a look at it for me.
Thank you.

Regards,

Obed

`if (t &lt; 1) return c/2*Math.pow(t,5) + b;` Re: Combining inPoint and outPoint Position Easeon Feb 21, 2020 at 8:37:18 pm

Hello Alex,

Please when I modified it, I have encountered error a the last line.
Thank you.

Regards,

Obed

```function easeInOutQuint(t, tMin, tMax, value1, value2){ b = value1; c = value2-b; d = tMax-tMin; t = tMin &lt; tMax ? thisLayer.linear(t,tMin,tMax,0,d) : thisLayer.linear(t,tMin,tMax,d,0); t /= d/2; if (t &lt;1) return c/2*Math.pow(t,5) + b; t -= 2; return c/2*(Math.pow(t,5) + 2) + b; } duration = 1; start=[3000,-3000]; destination = [960,540]; exit = [-3000,3000]; middle = (inPoint+outPoint)/2; v = time &lt; middle ? easeInOutQuint(time,inPoint,inPoint+duration,start,destination) : easeInOutQuint(time,outPoint-duration,outPoint,destination,exit); ```