mouseYGlobalThe y mouse coordinate.
createWindow(200, 200);
stroke(255);
function draw()
  background('purple');
  
  line(0, mouseY, width, mouseY);
endOutput
mouseXGlobalThe x mouse coordinate.
createWindow(200, 200);
stroke(255);
function draw()
  background('purple');
  
  line(mouseX, 0, mouseX, height);
endOutput
mouseIsPressedGlobalIs true when the mouse is pressed, is false when it's not.
mousePressed(button);EventCalled 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 = 12;
function setup()
  createWindow(400, 400);
  textAlign(CENTER);
end
function draw()
  background('purple');
  
  text('Click to grow the circle', width/2, 50);
  circle(width/2, height/2, size);
end
-- Increase circle size when mouse pressed
function mousePressed()
  size = size + 3;
endOutput
mouseReleased(button);EventCalled when a mouse button is released.
Arguments
buttonThe released mouse button
In the following example, the circle's size increases when the user clicks the mouse.
size = 12;
function setup()
  createWindow(400, 400);
  textAlign(CENTER);
end
function draw()
  background('purple');
  
  text('Click to grow the circle', width/2, 50);
  circle(width/2, height/2, size);
end
-- Increase circle size when mouse released
function mouseReleased()
  size = size + 3;
endOutput
mouseWheel(button);EventCalled 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);
endOutput