mousePressed

v0.1.6
mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


In the following example, the circle's size increases when the user clicks the mouse.

size = 0;

function setup()
  createWindow(400, 400);
end

function draw()
  background(51);

  circle(mouseX, mouseY, size);
end

-- Increase circle size when mouse pressed
function mousePressed()
  size = size + 1;
end
See mousePressed in mouse.h