ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

get number from another comp into Dan's Universal Counter

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bas v Breugel
get number from another comp into Dan's Universal Counter
on Mar 13, 2018 at 1:50:03 pm
Last Edited By Bas v Breugel on Mar 13, 2018 at 1:50:22 pm

Hi guys,

I am trying to make this automated ranking system.


I have 1 comp named 'CHANGE_TEXT' where I can input names and scores.

Inside another comp I have a Textfield with follwing code on the source text. I have animated it with drop in by character.
comp("CHANGE_TEXT").layer("01_firstname").text.sourceText

For the score I have used Dan's Universal code
numDecimals = 0;
commas = true
dollarSign = false;
beginCount = 0;
endCount = 250;
dur = 1.5;

t = time - inPoint;
s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

prefix = "";
if (s[0] == "-"){
prefix = "-";
s = s.substr(1);
}
if(dollarSign) prefix += "$";

if (commas){
decimals = "";
if (numDecimals > 0){
decimals = s.substr(-(numDecimals + 1));
s = s.substr(0,s.length - (numDecimals + 1));
}
outStr = s.substr(-s.length, (s.length-1)%3 +1);
for (i = Math.floor((s.length-1)/3); i > 0; i--){
outStr += "," + s.substr(-i*3,3);
}
prefix + outStr + decimals;
}else{
prefix + s;
}


I would like to have the endCount to reference a input from the Change_TEXT comp.

But this doesn't work:
numDecimals = 0;
commas = true
dollarSign = false;
beginCount = 0;
endCount = comp("CHANGE_TEXT").layer("01_count").text.sourceText;
dur = 1.5;

Any suggestions?


Return to posts index

Dan Ebberts
Re: get number from another comp into Dan's Universal Counter
on Mar 13, 2018 at 2:12:22 pm

You could try this:

endCount = parseFloat(comp("CHANGE_TEXT").layer("01_count").text.sourceText);

Dan



Return to posts index

Bas v Breugel
Re: get number from another comp into Dan's Universal Counter
on Mar 13, 2018 at 2:25:21 pm

You Sir, are a legend!!
That works like a charm ☺

One more idea/question. Is there a way to make the counter ease? So it starts quick and slows down at the end?
If not, no worries this allready is awesome.


Return to posts index


Dan Ebberts
Re: get number from another comp into Dan's Universal Counter
on Mar 13, 2018 at 3:20:34 pm

you could change

s = linear()

to

s = easeOut()


Dan



Return to posts index

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