The mouseDragged() function in p5.js is used to check the mouse drags (mouse moves and mouse button pressed). It is invoked each time when the mouse drags. If mouseDragged() function is not defined, then touchMoved() function will be used instead of mouseDragged() function.
Below programs illustrate the mouseDragged() function in p5.js:
Example 1: This example uses mouseDragged() function to change the background color.
Example 2: This example uses mouseDragged() function to change the mouse cursor circle color.
- p5.js | Mouse | mousePressed() Function
- p5.js | Mouse | mouseClicked() Function
- p5.js | Mouse | mouseMoved() Function
- p5.js | Mouse | mouseY
- p5.js | Mouse | mouseButton
- p5.js | Mouse | mouseReleased()
- p5.js | Mouse | pmouseX
- p5.js | Mouse | pmouseY
- p5.js | Mouse | mouseX
- p5.js | Mouse | mouseIsPressed
- p5.js | Mouse | winmouseX
- p5.js | Mouse | winmouseY
- How to distinguish left and right mouse click using jQuery?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.