Copy link to clipboard
Copied
Hello, I am trying to make this expression to show in percentage (%) and with 2 decimals.
Math.round(thisComp.layer("Shape Layer 1").effect("Slider Control 1")("ADBE Slider Control-0001")/100*comp("09 Infographic 19").layer("Data Settings").effect("Data 1")("ADBE Slider Control-0001"))
I am trying to do it with the " toFixed(2) " but I m having no luck.
Any suggestions?
Thanks in advance
I think you just need to append this to what you have:
.toFixed(2) + "%"
Copy link to clipboard
Copied
Multiply the input value by 100, round it, divide the value withe the same number. Oldest trick in the book. Simple math.
Mylenium
Copy link to clipboard
Copied
Hello and thank you for you answer.
The frustrating thing is that I know how to do math on paper or with a calculator but I have no clue how to do it with code.
What you said makes perfect sense but I don't know where or how to intergrade it in the expression 😕
Can you help?
Copy link to clipboard
Copied
I think you just need to append this to what you have:
.toFixed(2) + "%"
Copy link to clipboard
Copied
Great! Thank you very much. I added what you said at the end of the expression and gave me the .00% I wanted 🙂
You think it can give me any other result exept .00 all the time? Now it's showing 1.00%, 2.00%, 3.00% ......99.00%. Can I get a number like 3.36% for example and not just .00?
Copy link to clipboard
Copied
Nevermind. I removed the Math.round from the begining and it counts everything now!
See? I am learning! 😛
Thank you guys s much 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now