Decimal numbers in expression
Hi! I have created a counter on a text layer that counts length in increments om 40 cm controlled by a slider, I added this expression to the source text property and it works great except for the decimals.
t = effect("Slider Control")("Slider")
x = Math.round(t/.4)*.4+0.0001
x = x + " Meter"
x.toString().replace(".", ",");
It now counts 0,001 Meter.... 0,4001 Meter... 0,8001 Meter.... 1,2001 Meter..... but i want it to only show 2 decimals: 0,40..0,80..1,20..1,60...
I added the +0.0001 in Math.round to get decimals at the whole numbers. I.e. 4 Meter is now 4,0001 Meter... But how do I remove the last two digits? Or is there another way to always show 2 decimals? I need the counter speed to be controlled over time and masking is a problem since the font I use is not monospaced.
Thank you.
