Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding digits from Numbers filter

  • Adding digits from Numbers filter

    Posted by Chris Heuer on August 6, 2008 at 4:22 pm

    I’m low on time or I’d surf Dan’s site for this!

    I don’t know if this is possible…
    I have to update the Medal Count every day during the Olympics. The producer wants 3 columns (Gold, Silver, Bronze) and numbers below each that are changing randomly. We reveal the count by having each number lock into place, first Gold then Silver then Bronze. Then a “Total” Medal sum appears in RED.

    I’m using the effect: Effects>Text>Numbers to generate the number info

    Settings:
    “Type”is set to:Number
    “Decimal Places”is set to: 0 and
    “Value/Offset/Random”is set to: whatever Medal count I put in i.e. 435 (random is unchecked).

    I’d love to create an expression that adds the 3 numbers together and automatically applies the sum to my RED “Total” layer. The red layer doesn’t appear until the 3 digits stop animating so if this expression causes the RED number to animate, that’s ok!

    I hope this makes sense. Any pointers would be great.

    Thanks, Chris

    Chris Heuer
    Freefall FX, LLC

    Chris Heuer replied 17 years, 9 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    August 6, 2008 at 4:34 pm

    Unless I’m missing something, the expression for the total will look something like this (assuming all instances of the Numbers effect are applied to the same layer):

    gold = effect(“Numbers”)(“Value/Offset/Random Max”);
    silver = effect(“Numbers 2”)(“Value/Offset/Random Max”);
    bronze = effect(“Numbers 3”)(“Value/Offset/Random Max”);
    gold + silver + bronze

    Dan

  • Chris Heuer

    August 6, 2008 at 5:59 pm

    I was hoping to do it with one 3 digit instance of the numbers effect but after seeing your expression, I see how that probably doesn’t work. I’ll make an instance for each number and your expression should work perfectly!

    Thanks, Chris

    Chris Heuer
    Freefall FX, LLC

  • Dan Ebberts

    August 6, 2008 at 6:13 pm

    If you just want to add up the digit from one Numbers effect, this should work:

    s = Math.round(effect(“Numbers”)(“Value/Offset/Random Max”)).toString();
    total = 0;
    for (i = 0; i < s.length; i++){ total += parseInt(s[i],10); } total Dan

  • Chris Heuer

    August 6, 2008 at 7:03 pm

    I’m going to try that just for the learning. I turns out that the expression you gave me with 3 instances is the perfect solution because the medal counts should go into double digits. 3 double digit instances of the Numbers effect with your expression works perfectly!

    Thanks for the revised expression. I’ll put it to good use.

    Chris

    Chris Heuer
    Freefall FX, LLC

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