Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Link counters between compositions

  • Link counters between compositions

    Posted by Melissa Franch on June 16, 2023 at 12:31 pm

    Good afternoon!

    I have a problem that I can’t solve.

    I’m going to have a compo with many compos sequentially inside.

    But all these compos that go inside the main one have a layer somewhere that has a minute and second counter. And when putting them all in the main compo they have to coincide all the time with that of the main composition.

    I have a text layer (which all build counter text layers will read from) with this expression in source text:

    duration = thisComp.duration;

    currentTime = time;

    minutes = Math.floor(currentTime / 60);

    seconds = Math.floor(currentTime % 60);

    minutesText = minutes < 10 ? ‘0’ + minutes : minutes;

    secondsText = seconds < 10 ? ‘0’ + seconds : seconds;

    minutesText + “:” + secondsText;

    If I link the source text of the layer that I have precomposed to the source text of the layer of the main composition, the problem is that it reads me the time of the composition where the layer that I have linked is (the one that receives the expression), but this composition, for example, starts at second 5 of the main composition, so it should start counting at 5:00 and not at 0:00, which is what happens now.

    Help!!

    Melissa Franch replied 3 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 16, 2023 at 12:50 pm

    Assuming that your main comp is named “Main” and that each of your timer comps has a unique name, something like this should work:

    L = comp("Main").layer(thisComp.name);
    offset = L.startTime;
    currentTime = time + offset;
    minutes = Math.floor(currentTime / 60);
    seconds = Math.floor(currentTime % 60);
    minutesText = minutes < 10 ? '0' + minutes : minutes;
    secondsText = seconds < 10 ? '0' + seconds : seconds;
    minutesText + ":" + secondsText;
  • Melissa Franch

    June 19, 2023 at 1:25 pm

    You are the best!

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