Skip to main content
Participating Frequently
October 27, 2019
Question

Number counter using slider, 3 digits and 1 decimal place - HELP Please

  • October 27, 2019
  • 2 replies
  • 3574 views

Greetings,

I would like to animate a number slider with three digits and one decimals place. The expression below can get me three digits.

However, I can't figure out how to add one decimal place. Please help. Also, if you have a simpler expression, please share with me. 

str=""+Math.round(effect("Slider Control")("Slider"));while (str.length<3) str = "0" + str;str

Thank,

Sam

 

    This topic has been closed for replies.

    2 replies

    Dan Ebberts
    Community Expert
    Community Expert
    October 27, 2019

    Try it like this:

     

    str=effect("Slider Control")("Slider").value.toFixed(1);
    while (str.length<5) str = "0" + str;
    str

     

    Dan

    Participating Frequently
    October 28, 2019

    Dan,

    I tried. It worked. Thank you so very much for taking the time to help me out.

    Kind regards,

    Sam

    Mylenium
    Legend
    October 27, 2019

    http://www.motionscript.com/design-guide/counter.html

     

    All you are ever going to need...

     

    Mylenium

    Participating Frequently
    October 27, 2019

    Mylenium,

    Thank you very much for the link. I've read it twice. Still a bit confused. I'll try reading it again. 

    Sam