Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all articles
Browse latest Browse all 47983

Weird Behavior with Countdown Expression

$
0
0

I'm relatively new to aftereffects and have built this after adapting things I've learned from Google searchs.  I'm having very weird behavior in the last ten seconds of a one minute composition with my expression that generates hundreths of a second.

 

I have to use Countdowns for quite a lot of things.  but I only need them exported in small chunks, a minute, or ten seconds.  So my countdowns are rather unique.  Typically the first set of numbers is larger, the second and third set of numbers are smaller, but the same size, and the third set of numbers is a different color (typically a medium gray if the other numbers are white).

 

So because I have all these font parameters, I don't use a TimetoTimecode type of expression, because I need to be able to change the font size and color of a countdown so that 45:32:98 might look approximately like that, for example.  (and for whatever reason, the client wants hundreths of a seconds with a colon separating the seconds and hundreths, even though that is incorrect).

 

So because I only need small chunks, I have just text boxes for the first number and one of the colons and then use this expression for the seconds:

 

 

rate = - 1;

 

clockStart = 60

 

 

 

function padZero(n){if (n < 10) return "0" + n else return "" + n};

 

 

 

clockTime = Math.max(clockStart + rate*(time - inPoint),0);

 

 

 

t = Math.floor(clockTime);

 

min = Math.floor((t%3600)/60);

 

sec = Math.floor(t%60);

":" + padZero(sec)

 

Which seems to work beautifully.

 

Then for the Hundreths of a second, I use this expression:

 

 

st = 60

 

t = st - time;

 

t1 = Math.floor(t,timecodeBase = 99.9);

 

t2 = t.toFixed(2).substr(3)

 

 

 

t2

 

The composition is 720x1280 29.97 frame rate. with a 59;28 duration

 

The problem arises Exactly at the 50 second mark.  The hundreths expression suddenly reverts to a single 'tenths' column, but those numbers scroll randomly, they don't countdown as tenths, and they change every frame, at approximately like what the hundreths column changes at.


I'd really like to know why the countdown does that during the final 10 seconds and how do I fix it?

 

on the other hand if there is a better way to generate hundreths of a second, I'd like a better hundreths math expression, this countdown creates a persistence of vision problem by repeating the same hundreths numbers for about ten seconds before switching to a different pair of hundreths numbers.  Ideally Ilike a hundreths expression that did something like 97, 94, 91, 88, 83, 80, 76, 72, 69, 65, 62, 57, 54, 51 (repeating the pattern), rather than what I get, which is 97, 94, 91, 87, 84, 81, 77, 74, 71 (repeating the pattern of the same three numbers in the hundreths column for ten seconds when it then changes to 8, 5, 2 in the hundreths columns and repeats those same three numbers for the next ten seconds).  This is a persistence of vision problem if you see only those three numbers cycling on the hundreths column, your eye clearly percieves the 7,4,1 all superimposed on top of each other, and that's really annoying to me, because it interferes with the perception of the countdown.  But I can't seem to find a better hundreths expression to adapt or work with.

 

 



Viewing all articles
Browse latest Browse all 47983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>