ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Timer Start and stop at a specific value/number

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bert Beltran
Timer Start and stop at a specific value/number
on Oct 4, 2019 at 12:39:56 am

I'm trying to create a timer using Dan's Universal up/down expression. I have it set so that my expression looks like this:

I want it to count up like it's doing from Zero but then stop at 1:53:91. I think I need to add the clockEnd expression but Im having some trouble with how to include it into Dans expression.

rate = 1;
clockStart = 0;

function padZero(n){
return (n &lt; 10 ? "0" : "") + n;
}

clockTime = clockStart + rate*(time - inPoint);

if (clockTime &lt; 0){
sign = "-";
clockTime = -clockTime;
}else{
sign = "";
}

t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
ms = clockTime.toFixed(2).substr(-2);
sign + padZero(min) + ":" + padZero(sec) + "." + ms


Muchos Thank You's


Return to posts index

Dan Ebberts
Re: Timer Start and stop at a specific value/number
on Oct 4, 2019 at 1:14:05 am

Try this:


rate = 1;
clockStart = 0;

clockStopMin = 1;
clockStopSec = 53;
clockStopMs = 91;
clockStop = clockStopMin*60 + clockStopSec + clockStopMs/100;

function padZero(n){
return (n < 10 ? "0" : "") + n;
}

clockTime = Math.min(clockStart + rate*(time - inPoint),clockStop);

t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
ms = clockTime.toFixed(2).substr(-2);
padZero(min) + ":" + padZero(sec) + "." + ms



Dan



Return to posts index

Bert Beltran
Re: Timer Start and stop at a specific value/number
on Oct 4, 2019 at 2:14:50 am

Thanks Dan! Worked perfectly

Muchos Thank You's


Return to posts index

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