Copy link to clipboard
Copied
I'm trying to make a countdown timer from text, counting down from 10 minutes. I'm using an expression on a Slider Control that has always worked but it seems like it doesn't work with the latest update.
This is the expression I'm using:
slider = Math.round(effect("Slider Control")("Slider"))
sec = slider%60
min = Math.floor(slider/60)
function addZero(n){ if (n<10) return "0" + n else return n }
addZero(min) + ":" + addZero(sec)
I got the error on line 4:'' Error; SyntaxError; Unexpected 'else'
If anyone has any suggestions I would really appraciate the help!
All explained here:
https://helpx.adobe.com/after-effects/using/legacy-and-extend-script-engine.html
Sloppy expressions are no longer acceptable. Your if()else{} statement needs to be properly encased/ terminated with curly brackets. Reformatting also helps to detect such errors:
slider = Math.round(effect("Slider Control")("Slider"))
sec = slider%60
min = Math.floor(slider/60)
function addZero(n)
{
if(n<10)
{return "0"+n}
else
{return n}
}
addZero(min) + ":" + addZero(sec)
M
...Copy link to clipboard
Copied
All explained here:
https://helpx.adobe.com/after-effects/using/legacy-and-extend-script-engine.html
Sloppy expressions are no longer acceptable. Your if()else{} statement needs to be properly encased/ terminated with curly brackets. Reformatting also helps to detect such errors:
slider = Math.round(effect("Slider Control")("Slider"))
sec = slider%60
min = Math.floor(slider/60)
function addZero(n)
{
if(n<10)
{return "0"+n}
else
{return n}
}
addZero(min) + ":" + addZero(sec)
Mylenium
Copy link to clipboard
Copied
Thank you!