Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Substract numbers from 2 layers with expression

  • Substract numbers from 2 layers with expression

    Posted by Rockey klide on March 12, 2026 at 6:23 am

    How to make a countdown with , in the numbers like 9,700 until 6,000
    and how i can make calculations between 2 text layers that has number like this 9,700
    that has animation of a count down and i want to calculate for instance 9,700 and the other layer is 1,200 i want to substract 9,700-1,200 but because of the the , it doesnt recognize it as a number

    Rockey klide replied 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    March 12, 2026 at 1:28 pm

    This example will ramp from the number in layer “Text 1” to the number in layer “Text 2” (both formatted with commas) over the period defined by variable dur, starting at the time defined by variable tStart and format the result with commas:

    dur = 5;
    txt1 = thisComp.layer("Text 1").text.sourceText;
    n1 = parseFloat(txt1.replace(/,/g, ''));
    txt2 = thisComp.layer("Text 2").text.sourceText;
    n2 = parseFloat(txt2.replace(/,/g, ''));
    tStart = inPoint;
    tEnd = tStart + dur;
    n = linear(time,tStart,tEnd,n1,n2);
    parseInt(n,10).toLocaleString()
  • Rockey klide

    March 13, 2026 at 11:45 am

    Thank you 😀

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