-
scrolling numbers from 6000 to 30millions
Hi,
I’m trying to get a scroll from 6000 to 30 millions using a txt layer and a slider.
I’ve modified an expression by Dan Ebberts to get me halfway into a mess. Don’t really know what I’m doing.. but still:
num1=effect(“Slider Control”)(“Slider”);
num2=linear(num1,0,100000, 6000, 30000000); /* slider only goes to 1milion*/
s= ” ” + Math.floor(num2); /*don’t know what this does but needs to be done so you can read the amount of characters*/
n = s.length;
if (n > 3)
{
s.substr(0,n-3) + “,” + s.substr(-3); // separate with comas
}
if (n >5)
{
s.substr(0,n-6) + “,” +s.substr(-6,n-5) + “,” + s.substr(-3); //my messy modification
}
else
sRight, the problem is the numbers above a thousand. I just played around and found that s.substr(-6,n-5)sort of worked but I end up with 4 numbers instead of 3. So the final number would be 16,6356,380. Also the first number stays 0 all the time, would be cool if that number could run as well..
My apologies if this is really messy, but it’s late here with all what that means..
I’d be very happy if someone could clean this up for me!Thanks!
num1=effect("Slider Control")("Slider");
num2=linear(num1,0,100000, 6000, 30000000);
s= " " + Math.floor(num2);
n = s.length;
if (n > 3)
{
s.substr(0,n-3) + "," + s.substr(-3);
}
if (n >5)
{
s.substr(0,n-6) + "," +s.substr(-6,n-5) + "," + s.substr(-3);
}
else
s