Forums › Adobe After Effects Expressions › Precomp source text based on main comp time
-
Precomp source text based on main comp time
-
Kristine Jones
July 28, 2022 at 5:28 pmI’ve created a one hour countdown timer. At the start of each minute I’d like to transition to a different background for 5 seconds then transition out. This new background requires a change in the timer’s text color.
To achieve this I’ve created a precomp with the new background and a duplicate of the timer text layers with text recolored. Ideally I’d like to reuse this single comp multiple times on top of the main timer, instead of creating a new precomp for each minute’s change.
Within the precomp I’ve changed the source text expression to: comp(“countdown”).layer(“00”).text.sourceText;
This gives me the text I want to see, but from the beginning of the main countdown comp. If my precomp is located at X min on the main comp’s timeline, what code would I add to display the text at that point in time?
-
Dan Ebberts
July 28, 2022 at 5:51 pmTry this:
c = comp("countdown");
c.layer("00").text.sourceText.valueAtTime(time + c.layer(thisComp.name).startTime) -
Kristine Jones
July 28, 2022 at 6:00 pmPerfect. Thank you, Dan!
Log in to reply.