Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combining inPoint and outPoint Position Ease

  • Combining inPoint and outPoint Position Ease

    Posted by Obed Ampong on February 21, 2020 at 6:47 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?

    Thanks in advance.

    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 < 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]

    Obed Ampong replied 6 years, 2 months ago 2 Members · 5 Replies
  • 5 Replies
  • Alex Printz

    February 21, 2020 at 7:50 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 < tMax ? thisLayer.linear(t,tMin,tMax,0,d) : thisLayer.linear(t,tMin,tMax,d,0);

    t /= d/2;
    if (t < 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 < middle ? easeInOutQuint(time,inPoint,inPoint+duration,start,destination) : easeInOutQuint(time,outPoint-duration,outPoint,destination,exit);

    Alex Printz
    Mograph Designer

  • Obed Ampong

    February 21, 2020 at 8:06 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 < 1) return c/2*Math.pow(t,5) + b;

  • Alex Printz

    February 21, 2020 at 8:16 pm

    you have to add the less-than symbols back in, they don’t translate well on web:

    https://stackoverflow.com/questions/5068951/what-do-lt-and-gt-stand-for

    Alex Printz
    Mograph Designer

  • Obed Ampong

    February 21, 2020 at 8:37 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 < tMax ? thisLayer.linear(t,tMin,tMax,0,d) : thisLayer.linear(t,tMin,tMax,d,0);

    t /= d/2;
    if (t <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 < middle ? easeInOutQuint(time,inPoint,inPoint+duration,start,destination) : easeInOutQuint(time,outPoint-duration,outPoint,destination,exit);

  • Obed Ampong

    February 21, 2020 at 11:48 pm

    Hi Alex,

    I have fixed it. Thank you for support.

    Regards,

    Obed

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy