ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing time from seconds to frames in expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Obed Ampong
Changing time from seconds to frames in expression
on Apr 6, 2020 at 1:29:08 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 &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,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 &lt; middle ? easeInOutCubic(time,inPoint,inPoint+duration,start,destination) : easeInOutCubic(time,outPoint-duration,outPoint,destination,exit);


Return to posts index

Andrei Popa
Re: Changing time from seconds to frames in expression
on Apr 6, 2020 at 5:06:43 pm

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

duration = 30 * thisComp.frameDuration;

Andrei
My Envato portfolio.


Return to posts index

Obed Ampong
Re: Changing time from seconds to frames in expression
on Apr 7, 2020 at 8:55:20 am

Hello Andrei,

Thank you very much.

Regards

Obed


Return to posts index


Darby Edelen
Re: Changing time from seconds to frames in expression
on Apr 7, 2020 at 6:27:58 pm

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

timeToFrames(seconds);
framesToTime(frames);


Darby Edelen


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]