function
setup() {
createCanvas(600, 400);
textSize(20);
firstBlockSlider = createSlider(50, 250, 75, 1);
firstBlockSlider.position(30, 50);
secondBlockSlider = createSlider(50, 250, 175, 1);
secondBlockSlider.position(30, 120);
}
function
draw() {
clear();
fill(
'black'
);
text(
"Move the slider below to change the"
+
" first block's position"
, 20, 30);
text(
"Move the slider below to change the"
+
" second block's position"
, 20, 100);
text(
"The black circle demonstrates the"
+
" erase area"
, 20, 170);
fill(
'red'
);
rect(firstBlockSlider.value(), 200, 50, 100);
erase();
circle(150, 250, 100);
noErase();
fill(
'red'
);
rect(secondBlockSlider.value(), 200, 50, 100);
noFill();
circle(150, 250, 100);
}