Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Changing time from seconds to frames in expression

  • Changing time from seconds to frames in expression

  • Obed Ampong

    April 6, 2020 at 1:29 pm

    Hello,

    Please, the expression below has the time duration in seconds however I would like to change it to the number of frames.
    Thank you in advance.

    Regards,

    Obed

    function easeInOutCubic(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,3) + b;
    t -= 2;
    return c/2*(Math.pow(t,3) + 2) + b;
    }

    duration = 1;

    start=[-2000,540,-2000];
    destination = [960,540,0];
    exit = [2000,540,-3000];

    middle = (inPoint+outPoint)/2;

    v = time < middle ? easeInOutCubic(time,inPoint,inPoint+duration,start,destination) : easeInOutCubic(time,outPoint-duration,outPoint,destination,exit);

  • Andrei Popa

    April 6, 2020 at 5:06 pm

    Change the declaration of duration variable. That first number is the number of frames.

    duration = 30 * thisComp.frameDuration;

    Andrei
    My Envato portfolio.

  • Obed Ampong

    April 7, 2020 at 8:55 am

    Hello Andrei,

    Thank you very much.

    Regards

    Obed

  • Darby Edelen

    April 7, 2020 at 6:27 pm

    There are also expressions to convert a value in seconds to frames and vice versa:

    timeToFrames(seconds);
    framesToTime(frames);

    Darby Edelen

Viewing 1 - 4 of 4 posts

Log in to reply.

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