Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to create counting numbers keeping zero in front ie 01 -100

New Here ,
Sep 27, 2021 Sep 27, 2021

Hi everyone, really hoping someone can help. I am trying to count numbers from 00% to 100%. Please see expression below. But I want it to start with a zero in front like 00, 01,02,03...10,11,12, etc.

 

When I add "0" + Math.round... it in keeps the 0 on every number like 01,02...010, 011, etc

 

Any ideas?

---------------------------------

beginCount = 0;

stopCount = 100;

 

beginTime = 0; // start counting at time = 0

countDur = 5; // count for 5 seconds

 

"" + Math.round(linear(time,beginTime,beginTime + countDur,beginCount,stopCount)) + "%"

TOPICS
Expressions , How to
817
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 21, 2024 May 21, 2024

Math.round(effect("Slider Control")("Slider"))

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 21, 2024 May 21, 2024
LATEST

This should work:

beginCount = 0;
stopCount = 100;

beginTime = 0; // start counting at time = 0
countDur = 5; // count for 5 seconds
n = Math.round(linear(time,beginTime,beginTime + countDur,beginCount,stopCount));
(n < 10 ? "0" : "") + n + "%"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines