Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects AE Expression – Source text based on main comp time

  • AE Expression – Source text based on main comp time

    Posted by Kristine Jones on July 28, 2022 at 5:14 pm

    I’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?

    Graham Quince replied 4 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Graham Quince

    August 3, 2022 at 9:39 am

    Expressions in AE run every frame – so what’s needed is an IF statement to check the value of the source text – and when the source text displays a value within 5 seconds of each minute, then run that colour change function.

    Something like:

    var mins = parseInt(time/60);

    var secs = parseInt(time)-(mins*60);

    var col = "#FF0000";

    if (secs < 6 || secs > 55) {

    col = "#00FF00";

    }

    hexToRgb(col)

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy