xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
}
let pos = 25;
function draw() {
background(color('#f5f5f5'));
fill(0);
triangle(30, 75, pos, 20, 86, 75);
describe(`black 50-by-50 rect moves up and down with vertical scroll.
fuchsia background`);
}
function mouseWheel(event) {
print(event.delta);
//move the square according to the vertical scroll amount
if(event.delta>0){pos += sqrt(abs(event.delta));}
else{pos -= sqrt(abs(event.delta));}
//uncomment to block page scrolling
//return false;
}