mouseWheel

v0.1.7
mouseWheel(button);Event

Called when a mouse wheel is used.

Arguments

buttonThe 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

See mouseWheel in mouse.h