Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Obed Ampong on February 20, 2020 at 11:42 am

    Hello,

    I am trying to change this expression easing from Cubic to Quad, can anyone help me? Replacing the “Cubic” with “Quad” in the expression has been unsuccessful.

    Thanks in advance.

    Regards,

    Obed

    function easeInOutCubic(t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 };

    startVal = -2000;
    endVal = 0;
    startDur = 1;
    endDur = 2;

    t = ease(time,inPoint+startDur,inPoint+endDur,0,1);
    e = easeInOutCubic(t);
    x = ease(e,0,1,startVal,endVal);

    [value[0], value[1],x];

    Alex Printz replied 6 years, 2 months ago 3 Members · 6 Replies
  • 6 Replies
  • Kyung Ko

    February 20, 2020 at 3:15 pm

    Try this function…

    function easeInOutQuad(t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t };

  • Obed Ampong

    February 20, 2020 at 3:58 pm

    Hi Kyung,

    Please, it was unsuccessful. it displaced error in line 9 of the expression.
    Thanks

    Regards,
    Obed

  • Alex Printz

    February 20, 2020 at 6:30 pm

    I’m not sure how to fix yours off the top of my head, but here is my own quadratic easing function:

    function easeInOutQuad (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,2) + b;
    t--;
    return -c/2 * (t*(t-2) - 1) + b;
    }

    Alex Printz
    Mograph Designer

  • Obed Ampong

    February 20, 2020 at 7:09 pm

    Just to clarify, I am easing on position property. Changing position without any keyframe. Starting from InPoint time with a duration of 1 second.

  • Obed Ampong

    February 20, 2020 at 7:24 pm

    Hi,

    I have fixed by following going through the forums. I go what I was looking for. Thanks

    Regards,

    Obed

  • Alex Printz

    February 20, 2020 at 7:29 pm

    You don’t need anything in particular to do that, just use the function I gave you. Here it is on the x-property.

    function easeInOutQuad (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,2) + b;
    t--;
    return -c/2 * (t*(t-2) - 1) + b;
    }

    startVal = -2000;
    endVal = 0;
    startTime = thisLayer.inPoint;
    endTime = startTime+1;

    px = easeInOutQuad (time, startTime, endTime, startVal, endVal);

    [px,thisComp.height/2]

    Alex Printz
    Mograph Designer

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