-
code troubleshooting
Hi all. The solution here is probably very simple. AE keeps telling me there’s an error in line 7. “expected: ;.”
I referred to this site for syntax (https://www.w3schools.com/js/js_if_else.asp), and I think all my semi-colons are in place. What did I miss?
Background Info: We create a lot of ‘trivia question’ animations. Text layers display a question with multiple choices for answers. After a period of time, the correct answer glows. I want this expression to automatically position the glow adjustment layer over the correct answer so I don’t have to manually change it every time.
I figure I’ll apply it to the glow adjustment layer’s position property. The idea is that the expression checks to see which of the multiple choices has the same source text as the ‘correct answer’ layer (text layer with visibility off) and then positions the adjustment layer to it.
The expression:
ANSWER1 = thisComp.layer(“Answer 1”).transform.position;
ANSWER2 = thisComp.layer(“Answer 2”).transform.position;
ANSWER3 = thisComp.layer(“Answer 3”).transform.position;
ANSWER4 = thisComp.layer(“Answer 4”).transform.position;
GLOW = transform.position;If (comp(“3 – Answer 1”).layer(“Answer 1”).text.sourceText = thisComp.layer(“Answer”).text.sourceText){
GLOW = ANSWER1;
}
else If (comp(“4 – Answer 2”).layer(“Answer 2”).text.sourceText = thisComp.layer(“Answer”).text.sourceText){
GLOW = ANSWER2;
}
else If (comp(“5 – Answer 3”).layer(“Answer 3”).text.sourceText = thisComp.layer(“Answer”).text.sourceText){
GLOW = ANSWER3;
}
else {
GLOW = ANSWER4;
}