Here is the code for an analog clock. Please check my code and help me with a solution….
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
…you need to clear the canvas every time you draw to it.
In this case, you can’t even really do the dirty-rectangle solutions without working out a blitting system, like the old-school games.
So you need to call ctx.clearRect() on every single call to clock().
…not just the call to analog();
The other solution is to have two canvases, position them on top of one another with CSS, and have one hold the clock image, and have the other constantly draw and clear and redraw the arms.