[−][src]Static p5_sys::global::mouseDragged
pub static mouseDragged: MouseDraggedInternalType
The mouseDragged() function is called once every time the mouse moves and
a mouse button is pressed. If no mouseDragged() function is defined, the
touchMoved() function will be called instead if it is defined.
Browsers may have different default
behaviors attached to various mouse events. To prevent any default
behavior for this event, add "return false" to the end of the method.
Examples
// Drag the mouse across the page // to change its value let value = 0; function draw() { fill(value); rect(25, 25, 50, 50); } function mouseDragged() { value = value + 5; if (value > 255) { value = 0; } }
function mouseDragged() { ellipse(mouseX, mouseY, 5, 5); // prevent default return false; }
// returns a MouseEvent object // as a callback argument function mouseDragged(event) { console.log(event); }
Parameters
event?
optional MouseEvent callback argument.