Skip to main content
animatorinprogress
Participant
September 28, 2021
Question

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

  • September 28, 2021
  • 2 replies
  • 790 views

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)) + "%"

This topic has been closed for replies.

2 replies

Dan Ebberts
Community Expert
Community Expert
May 21, 2024

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 + "%"
Participant
May 21, 2024

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