Name

mouseWheel()

Examples
background_color = 127

def setup(): 
    size(100, 100)

def draw(): 
    background(background_color)

def mouseWheel(event): 
    e = event.getCount()
    background_color += event.getCount()
    # keep value in range
    background_color = background_color % 255
Description The mouseWheel() function returns positive values when the mouse wheel is rotated down (toward the user), and negative values for the other direction (up or away from the user). On OS X with "natural" scrolling enabled, the values are opposite.

Mouse and keyboard events only work when a program has draw(). Without draw(), the code is only run once and then stops listening for events.
Syntax
mouseWheel(event)
Parameters
eventMouseEvent: the MouseEvent
Related mouseX
mouseY
pmouseX
pmouseY
mousePressed
mousePressed()
mouseReleased()
mouseClicked()
mouseMoved()
mouseDragged()
mouseButton

Updated on Mon Sep 21 15:53:25 2020.

If you see any errors or have comments, please let us know.