Skip to main content
Participant
August 28, 2018
Question

"This project contains a expression error: error 1 of 1" in After Effect. Help.

  • August 28, 2018
  • 1 reply
  • 2248 views

"This project contains a expression error: error 1 of 1" in After Effect. Help.

rateOfSpeed=1;

clockStartTime = thisComp.layer(“slider”).effect(“Slider Control”)(“Slider”)*60;

clockTimeNumber = Math.floor(clockStartTime – rateOfSpeed*time);

function addZero(n) {

if (n<10) return “0” + n else return n;

}

minutes = Math.floor(clockTimeNumber/60);

seconds = clockTimeNumber%60;

if (clockStartTime > 0 && time < clockStartTime) {

addZero(minutes) + “:” + addZero(seconds);

} else {“00:00”}

This is the code I'm using to create a timer but there is an error and it dosen't work.

[This post moved to After Effects Scripting by Moderator]

This topic has been closed for replies.

1 reply

Andrei Popa
Inspiring
September 8, 2018

Took me like 15 minutes to figure this out. It's your keyboard. Switch it to English. The quotes are not of the correct type. Also, your minus from the third line of code its not a minus. Here is the working code:

rateOfSpeed=1;

clockStartTime =thisComp.layer("slider").effect("Slider Control")("Slider")*60;

clockTimeNumber = Math.floor(clockStartTime - rateOfSpeed*time);  

function addZero(n) {

if (n<10) return "0" + n else return n;

}

minutes = Math.floor(clockTimeNumber/60);

seconds = clockTimeNumber%60;

if (clockStartTime > 0 && time < clockStartTime) {

addZero(minutes) + ":" + addZero(seconds);

} else {"00:00"}

Inspiring
October 25, 2018