mouseWheel(button);
EventCalled when a mouse wheel is used.
Arguments
button
The pressed mouse button
In the following example, the circle's size changes when the user scrolls.
size = 32;
function setup()
createWindow(400, 400);
textAlign(CENTER);
end
function draw()
background('purple');
text('Scroll to change the size', width/2, 50);
circle(width/2, height/2, size);
end
-- Increase circle size when mouse scrolled
function mouseWheel(delta)
size = max(size - delta * 3, 3);
end
Output