Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Is there a way to make a rectangular area 0 alpha (transparent) after it has been drawn on to?

I've seen lots of questions asking how to draw a semi-transparent rectangle or other shape onto canvas after it's already been drawn to. My problem is that I want a rectangular area to be 0 alpha, but it seems to draw just nothing on top of what is there. I understand why that is (you are drawing 0 alpha on top of something that is already drawn), but I want those pixels 0 alpha. There has to be way.

Basically, I want to define an area that has 0 alpha after the canvas has already something drawn to it.

function fillPreviewClearColor(x,y)
{
    ctx2.beginPath();
    ctx2.rect(x, y, 10, 10);
    ctx2.fillStyle = "rgba(255, 255, 255, 0.0)"; // I want NOTHING here
    ctx2.fill();    
    ctx2.restore();
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!