Copy link to clipboard
Copied
Hey,
Before the 2019 update for After Effects, my expression for a countdown clock was working a treat. Now the If else statement seems to have had a definition change and I can't seem to find where the issue is. Does anyone have an idea of what could be happening?
Here is the original expression:
rate = -1;
clockStart = 899.97;
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);
msec = clockTime.toFixed(2).substr(-2);
padZero(min) + ":" + padZero(sec) + ":" + msec;
Thanks
if (n < 10) return "0" + n else return n;
}
You sure that's proper syntax?
Shouldn't it be
if(condition) {code} else {code}
???
Also AE should be telling what line the error is on. You don;t get an error message?
Copy link to clipboard
Copied
if (n < 10) return "0" + n else return n;
}
You sure that's proper syntax?
Shouldn't it be
if(condition) {code} else {code}
???
Also AE should be telling what line the error is on. You don;t get an error message?
Copy link to clipboard
Copied
Gutterfish is right. Adobe changed the expression-engine in CC2019 to a strict one.
Hold on proper syntax and it will work again.
Copy link to clipboard
Copied
What the others said already - it helps to adhere to proper syntax, not play it dirty and use crooked/ illegal shorthands and hope the engine will figure it out.
Mylenium
Copy link to clipboard
Copied
It would help even more if Adobe wouldn't pull the rug out from underneath us with changes like this, breaking things that were working fine previously
Copy link to clipboard
Copied
You can still switch to the old engine - the option is in project project settings.
Writing proper code in the first place would be the best way to handle this, of course.
*Martin
Copy link to clipboard
Copied
Cheers,
yea... added proper syntax and it worked again haha.
Thanks for the help
Copy link to clipboard
Copied
For those who are NOT code mavens, I had the exact same problem and carefully replaced line A: with line B:
A: if (n < 10) return "0" + n else return "" + n
B: if(n < 10) {return "0" +n} else {return"" + n}
And by sheer miracle, it worked! I am a novice AE user, and I know even less about AE Expressions, but if I can do it ANYBODY can do it!