Skip to main content
Participating Frequently
November 5, 2024
Question

Leading zero and decimal in slider control

  • November 5, 2024
  • 1 reply
  • 904 views

I'm trying to increase a number from 0 to 49.3 with slider control, but I need it to keep the decimal 0 on integers, and to add a leading 0 from 0 to 9. I've tried many expressions, and noticed that the leading number works if its anything but 0, for example, if I try to add "20" to the string on the condition < 10, it will add the 20, but it won't add the "0". 

As for the integers decimal, I really couldn't make it work, even using expressions marked as 'solutions' on the forum. I wonder if the newer versions of AE changed something. 

Anyone can help?

Thanks! 

This topic has been closed for replies.

1 reply

Legend
November 5, 2024
"0" + effect("Slider Control")(1)

// 9 => 09
// 20 => 020

isn't enough?

erickdauAuthor
Participating Frequently
November 5, 2024

Not quite, I need it from 0 to 10 only - for which I can make an if statement, but still, the zero won't show up. If I put any other value, it will show before the numbers, but not the "0". Is that normal??

Thanks for trying!! 

Legend
November 5, 2024

From 0 to 9:

val = effect("Slider Control")(1);
val < 10 ? "0" + val : val