ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Number of digits

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Pavol Feješ
Number of digits
on Oct 23, 2017 at 8:18:53 pm

Hi. I'm trying to find a way to return the number of digits from the slider.
for example: my slider has a value of 1405. How do I write that number = 4?
Does anyone know any advice?


Return to posts index

Dan Ebberts
Re: Number of digits
on Oct 23, 2017 at 8:41:24 pm

Something like this:

n = effect("Slider Control")("Slider");
Math.round(n).toString().length;

Dan



Return to posts index

Kevin Camp
Re: Number of digits
on Oct 23, 2017 at 8:57:25 pm

this seems a little clunky, but i think it will work:
s = " " + effect("Slider Control")("Slider").value;
s.split(" ")[1].length;

essentially you need to get the number value to be a text string rather than a number, then you can use length to return the number of characters (minus the space that we added to convert the slider value to a string)

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index


Pavol Feješ
Re: Number of digits
on Oct 24, 2017 at 5:25:39 am

Thanks for your refinement. Both are very clever. I've used Dan's way and it works perfectly.


Return to posts index

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