ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Adding digits from Numbers filter

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Heuer
Adding digits from Numbers filter
on Aug 6, 2008 at 4:22:53 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


Return to posts index

Dan Ebberts
Re: Adding digits from Numbers filter
on Aug 6, 2008 at 4:34:24 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



Return to posts index

Chris Heuer
Re: Adding digits from Numbers filter
on Aug 6, 2008 at 5:59:04 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


Return to posts index


Dan Ebberts
Re: Adding digits from Numbers filter
on Aug 6, 2008 at 6:13:24 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



Return to posts index

Chris Heuer
Re: Adding digits from Numbers filter
on Aug 6, 2008 at 7:03:15 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]