Page 1 of 1

Help reducing decimal in counter

PostPosted: Thu Jan 10, 2019 5:44 am
by 3drogelio
I only need 2 decimal places in the counter. It seems by default to have more than 10 decimal places. How do you reduce them?

Re: Help reducing decimal in counter

PostPosted: Thu Jan 10, 2019 8:06 am
by Frank Feijen
Where did you find/How did you create that counter?
I'm guessing that it's easy to fix with an expression?

Re: Help reducing decimal in counter

PostPosted: Thu Jan 10, 2019 4:52 pm
by Bryan Ray
Assuming you're using something like a Text+ node, you need to format the string like so:

Text( string.format("%.5f", [number source]) )

In the string.format() function, the first argument determines how to handle the number. In this case, %.5f means that a floating-point number will have up to five digits after the decimal. To give it only two decimals, the string is %.2f.

The number source is whatever is feeding the Text. So it's probably whatever is currently in your Text() expression.

Re: Help reducing decimal in counter

PostPosted: Thu Jan 10, 2019 9:16 pm
by 3drogelio
I am new to expressions and did some searching online. The way I ended up approaching it was the following:
added Test+ node and set the Styled Text to expression and then linked(Controlled) that to the Number In 1 slider of a CustomTool1 node to control the animation of the numbers. I need it to go up and down between 2 sets of range numbers. This seemed to get me 90% of the way there. I just don't need all the decimals. I only need 2. See screen grabs

It would be nice if there was a setting where I change the appearance to just show only 2 or 1 decimal place

Bryan, I tried the expression you gave but not sure how to animate the exact numbers I need. I would need it to go from 2.2 to 1.2 for about 50 frames and then go back to 2.2 after another 50 frames. I would probably need this to repeat a couple of times. Since I could not figure that out, I did it the way I explained above.

Any thought or suggestions?
Thanks
Rogelio

Re: Help reducing decimal in counter

PostPosted: Sun Jan 13, 2019 4:53 pm
by 3drogelio
Does anyone have a solution on how to get rid of the extra decimals?

Thanks
Rogelio