[−][src]Static p5_sys::global::erase
pub static erase: EraseInternalType
All drawing that follows erase() will subtract from the canvas.Erased areas will reveal the web page underneath the canvas.Erasing can be canceled with noErase().
Drawing done with image() and background() in between erase() and noErase() will not erase the canvas but works as usual.
Examples
background(100, 100, 250); fill(250, 100, 100); rect(20, 20, 60, 60); erase(); ellipse(25, 30, 30); noErase();
background(150, 250, 150); fill(100, 100, 250); rect(20, 20, 60, 60); strokeWeight(5); erase(150, 255); triangle(50, 10, 70, 50, 90, 10); noErase();
function setup() {
smooth();
createCanvas(100, 100, WEBGL);
// Make a <p> element and put it behind the canvas
let p = createP('I am a dom element');
p.center();
p.style('font-size', '20px');
p.style('text-align', 'center');
p.style('z-index', '-9999');
}
function draw() {
background(250, 250, 150);
fill(15, 195, 185);
noStroke();
sphere(30);
erase();
rotateY(frameCount * 0.02);
translate(0, 0, 40);
torus(15, 5);
noErase();
}
Parameters
strengthFill?
A number (0-255) for the strength of erasing for a shape's fill.
This will default to 255 when no argument is given, which
is full strength.
strengthStroke?
A number (0-255) for the strength of erasing for a shape's stroke.
This will default to 255 when no argument is given, which
is full strength.