Jump to: Board index » General » Fusion

Help reducing decimal in counter

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

3drogelio

  • Posts: 3
  • Joined: Thu Jan 10, 2019 5:37 am
  • Real Name: Rogelio Guzman

Help reducing decimal in counter

PostThu Jan 10, 2019 5:44 am

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?
Offline

Frank Feijen

  • Posts: 100
  • Joined: Tue Dec 13, 2016 10:04 am
  • Location: Vilvoorde, Belgium

Re: Help reducing decimal in counter

PostThu Jan 10, 2019 8:06 am

Where did you find/How did you create that counter?
I'm guessing that it's easy to fix with an expression?
Offline
User avatar

Bryan Ray

  • Posts: 1056
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Help reducing decimal in counter

PostThu Jan 10, 2019 4:52 pm

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.
Bryan Ray
http://www.bryanray.name
http://www.musevfx.com
Offline

3drogelio

  • Posts: 3
  • Joined: Thu Jan 10, 2019 5:37 am
  • Real Name: Rogelio Guzman

Re: Help reducing decimal in counter

PostThu Jan 10, 2019 9:16 pm

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
Attachments
Text+Node.PNG
Text+ Node
Text+Node.PNG (40.82 KiB) Viewed 257 times
Decimal issue 2.PNG
Decimal with to many places
Decimal issue 2.PNG (38.15 KiB) Viewed 257 times
Decimal issue 1.PNG
Decimal starts of right
Decimal issue 1.PNG (46.74 KiB) Viewed 257 times
Offline

3drogelio

  • Posts: 3
  • Joined: Thu Jan 10, 2019 5:37 am
  • Real Name: Rogelio Guzman

Re: Help reducing decimal in counter

PostSun Jan 13, 2019 4:53 pm

Does anyone have a solution on how to get rid of the extra decimals?

Thanks
Rogelio

Return to Fusion

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests