Page 1 of 1

Linking number counter speed to percentage (slider) value

PostPosted: 08/20/2018, 9:12 am
by Rambjoer92
Hi there!

I have a problem with linking the speed of a number counter on a graph follow the speed at which the graph itself progresses.
The graph stops at certain intervals through a trim path-animation I've keyframed, which the position of the number counter is linked to, but the counter progresses when the graph stops.


I've used this expression for the number counter, which I picked up at the Creative Cow Forums:

Code: Select all
numDecimals = 0;
commas = true;
dollarSign = false;
beginCount = 0;
endCount = 12400000000;
dur = 18;

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;
}


With the little knowledge I have of expressions, I can't figure out how I can link the completion of the counter to correspond with the slider value that's linked to the Trim Paths-value. So, does anyone here have any input of how I can add a completion-expression to this existing expression?

Cheers
Øystein