Is it possible to erase part of an object and let the background show through?

Is it possible to erase part of an object such as a rectangle or ellipse and allow the background color to show through? In the example I’ve got the background set to a gradient and am attempting to erase two rectangles from a red ellipse. The “erase()” function apparently erases everything, including the background color.

let c1,c2;

function setup() {
createCanvas(windowWidth, windowHeight);
  c1 = color(255);
  c2 = color(63, 191, 191);
  for(let y=0; y<height; y++){
    n = map(y,0,height,0,1);
    let newc = lerpColor(c1,c2,n);
    line(0,y,width, y);

function draw() {
 fill(255, 0, 0);

Hi! As you said erase erases even the background (there is no sense of layers in canvas). So you need to createGraphics to make them into separate layers

Awesome! Thank you so much!