/** a small mousewheel tutorial by guru */ void setup() { size(300,300); smooth(); addMouseWheelListener(new java.awt.event.MouseWheelListener() { public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) { mouseWheel(evt.getWheelRotation()); }}); } float s = 10; void mouseWheel(int delta) { float t = s + delta * 2; if (t> 2 && t < 300 ) { s = t; } } void draw() { background(255); stroke(0); translate( width/2, height/2); int cnt = int( width/s); for( int x = -cnt; x < cnt; x++) { for( int y = -cnt; y < cnt; y++ ) { rect(x * s - s/2, y * s - s/2, s, s ); } } }