| **How to add 0 in a counter to show 00, 01, 02... ?**
on Sep 10, 2019 at 9:42:23 am |

Hi everyone,

I want to add a 0 to the counter when it's going from 0 to 9.

The result should be like this :

%00, %01, %02... then %10, %11

Struggling for hours now but I know you guys can help.

Thank you so much.

Hassan

`number = thisComp.layer("PERCENTAGE").effect("Percentage RIGHT")("Slider");`

rounded = Math.round(number *100) /100;

number2 = "%"""+rounded.toFixed(1);

| **Re: How to add 0 in a counter to show 00, 01, 02... ?** on Sep 10, 2019 at 4:14:42 pm |

Try this:

num = thisComp.layer("PERCENTAGE").effect("Percentage RIGHT")("Slider");

n = Math.round(num);

(n < 10 ? "0" : "") + n

Dan

| **Re: How to add 0 in a counter to show 00, 01, 02... ?** on Sep 11, 2019 at 11:10:37 am |

Thanks a lot Dan,

You are a HERO.

I changed the expression a little to add the % symbol like this :

n= thisComp.layer("PERCENTAGE").effect("Percentage_RIGHT")("Slider");

n2= Math.round(n *100) /100;

"%"+(n2 < 10 ? "0" : "") + n2