Conditionally increment value after some time
I though it would be easy but I was heavily wrong. I'm searching for hours now but I couldn't find a solution. Maybe you can help me. I'll simplify the structure to make it easier to understand.
I have a "main" composition with 2 text layers (layer_1 and layer_2). The initial value of layer_1 is 0 and it's shown from the very beginning of the timeline. layer_2 is 5 seconds time-displaced and has a source text expression with an if/else statement.
Example:
var myVar = "test";
if(myVar == "test") {
"Hello World";
}
Within the expression of layer_2 I'd like to increment the value from layer_1 after 5 seconds.
Example:
var myText = thisComp.layer("layer_1").text.sourceText;
var myVar = "test";
if(myVar == "test") {
thisComp.layer("layer_1").text.sourceText.style.setText(myText + 1);
"Hello World";
}
Unfortunately this isn't working. It seems I can not manipulate the source text from layer_1 within the expression of layer_2.
I checked many YouTube tutorials but I couldn't find the answer how to change the value of a text layer after a certain time depending on a condition.
I'm thankful for any kind of help.
