Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:04:25+00:00 2026-06-13T12:04:25+00:00

I made a countdown with a canvas drawing working code : http://jsfiddle.net/ajFsx/ window.onload =

  • 0

I made a countdown with a canvas drawing

working code : http://jsfiddle.net/ajFsx/

window.onload = function() {
    canvas  = document.getElementById('timer'),
    seconds = document.getElementById('counter'),
    ctx     = canvas.getContext('2d'), 
    sec     = 180,
    countdown = sec;
    ctx.lineWidth = 8;
    ctx.strokeStyle = "#528f20";
    var 
    startAngle = 0, 
    time       = 0,
    intv       = setInterval(function(){
        var endAngle = (Math.PI * time * 2 / sec);
        ctx.arc(65, 35, 30, startAngle , endAngle, false);   
        startAngle = endAngle;
        ctx.stroke();

        countdown--;
        if ( countdown > 60){
            seconds.innerHTML = Math.floor(countdown/60);
            seconds.innerHTML += ":" + countdown%60;
        }
        else{
            seconds.innerHTML = countdown;
        }
        if (++time > sec,countdown == 0 ) { clearInterval(intv), $("#timer, #counter").remove(), $("#timers").prepend('<img id="theImg" src="#" />'); }
    }, 10);
}​

My question is the following how can i get this drawing better looking, so no pixels?

I googled a lot at jquery canvas but i can’t seem to find where i’m looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:04:26+00:00Added an answer on June 13, 2026 at 12:04 pm

    Canvas drawing is anti-aliased by default.

    You’re always drawing over your previous frames.

    jsFiddle (proof).

    You can easily fix that by calling…

    ctx.clearRect(0, 0, 200, 200);
    

    jsFiddle.

    This clears the previous drawn 200px square in the top left corner.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Made a new project, added main.cpp and wrote the code at this URL: http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp
Hello everybody i have asp.net mvc4 application where i made countdown something like this:
I have made separate project for countdown timer and it is working fine. Now
I made a countdown timer and coded this in with HTML and CSS, but
I made a Web service in which I have a function to count some
Made a module in python. Which is acting as a model of machine code.
Made this custom alert box: <script type="text/javascript"> $(function () { var $alert = $('#alert');
made a menu out of the following code but the original href in the
I was looking for help last week to get a simple javascript code made
I have an application with a countdown timer. I've made it with a label

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.