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 6253423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:59:29+00:00 2026-05-24T13:59:29+00:00

I am working on a doodle in canvas, I am running into an issue

  • 0

I am working on a doodle in canvas,

I am running into an issue where when I erase the object by overdrawing it with the background color I am left with an outline of the original shape. enter image description here

Here is the code I am using

and yes I am not using clear rect because the circles can overlap.

    function erase(eraseColor) {
    ctx.fillStyle = ctx.strokeStyle = eraseColor || "#FFFFFF";
    drawCircle();
    ctx.fillStyle = ctx.strokeStyle = fillColor;
}

function drawCircle() {
    ctx.beginPath();
    ctx.arc(x, y, rad, 0, Math.PI * 2, true);
    ctx.closePath();
    ctx.fill();
}
  • 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-05-24T13:59:30+00:00Added an answer on May 24, 2026 at 1:59 pm

    I believe this is due to anti-aliasing. The effect should not appear on shapes that do not require anti-aliasing (like rectangles). Draw the erasing circle a few pixels bigger (one should do).

    In case the question comes up: you cannot turn off anti-aliasing for canvas.

    As Ray suggested you should think about using frame based animation, optimized by using dirty rectangles.

    To do this you simply flag a rectangle as dirty, if any pixels within it have changed (eg due to animation). You then clear the rectangle on the canvas (clearRect) and set it as a clipping rectangle (clip). Then you iterate through all elements that are displayed on your canvas and check wether they overlap with your dirty rectangle. If so, you draw the element, if not you skip to the next element.

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

Sidebar

Related Questions

Working with phoneGap implementing drawing with Canvas. The catch we've run into is that
Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
Working on an app using Akka 2 deployed with Play-mini. I pulled logback into
Working on a console application using Delphi 7, and have run into a problem.
I've been working on a SWF that will be converted into a Projector file,
Working on a project, I have this issue where my array slicetable returns undefined
Working with an undisclosed API, I found a function that can set the number
Working with H2 I get this error when I try to write a row
Working on the problems on Project Euler to try to learn Clojure. I'm on

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.