0

I'm developing a website and want a counter upon start up to go from 1,000-1,000,000 So we decided the best way to do it would be to put a video on the cover that would play on start up. Now how do I create a counter like that? in photoshop/online/gimp/anywhere?

Please feel free to ask any questions for further clarifications, etc.

thanks.

7
  • 9
    use javascript, its better for the user and your bandwidth-load times. (1000000/60/60/25 = 11 hours of video, so at 4 times compression speed it will take 3 hours just to encode the video)
    – joojaa
    Dec 19, 2018 at 18:18
  • 3
    @joojaa is correct.... Javascript is absolutely the way to go.
    – Scott
    Dec 20, 2018 at 7:51
  • @joojaa I tried, it’s been days and I still can’t figure it out. How would I do that? I want it in text format and for it too take around 5 seconds upon startup to go to a number around 1,000,000. How would you do that?
    – A.D.
    Dec 20, 2018 at 11:13
  • @Scott do you have any input on this one?
    – A.D.
    Dec 20, 2018 at 11:14
  • 3
    Igor, a simple google search for "jquery counter" returns hundreds of results and samples. If you aren't employing jquery, it can be done with vanilla javascript as well.
    – Scott
    Dec 20, 2018 at 18:01

1 Answer 1

1

I know I'm a bit late to the party, but as others have mentioned in the comments on the question, it would be best to use JavaScript instead of creating a video to show a counter.

Using JavaScript has the added advantage of allowing you to configure the counter values and styles on the fly.

The code in the body of the HTML code below would give you a simple counter that starts counting once the body has loaded. It's generally better to have the JavaScript code in its own file, but I've kept it within the HTML to make it a bit easier for the answer.

<!DOCTYPE html>
<html>

<head>
  <title>Counter</title>
</head>

<body>
  <!-- div with counter ID displays the current count value -->
  <div id="counter"></div>

  <!-- script containing code. Should be in its own file -->
  <script>
    document.body.onload = function () {
      let count = 1000; // Start at 1000

      let countInterval = setInterval(() => {
        // Stop at 1000000
        if (count === 1000000) {
          clearInterval(countInterval);
        }

        count += 1; // Increase the count by 1 or any other given value
        // Display new count in counter div element
        document.getElementById('counter').innerText = count;
      }, 1); // Increase count every 1 millisecond
    };
  </script>
</body>

</html>

You can enhance this by using CSS and using your own HTML elements to style the counter in the way you prefer.

This is more of a Stackoverflow question than a graphic design question by the way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.