Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
Name | pmouseX |
---|---|
Examples | // Move the mouse quickly to see the difference // between the current and previous position void draw() { background(204); line(mouseX, 20, pmouseX, 80); } |
Description | The system variable pmouseX always contains the horizontal position of the mouse in the frame previous to the current frame. You may find that pmouseX and pmouseY have different values inside draw() and inside events like mousePressed() and mouseMoved(). This is because they're used for different roles, so don't mix them! Inside draw(), pmouseX and pmouseY update only once per frame (once per trip through your draw()). But, inside mouse events, they update each time the event is called. If they weren't separated, then the mouse would be read only once per frame, making response choppy. If the mouse variables were always updated multiple times per frame, using |
Syntax | pmouseX |
Usage | Web & Application |
Related | pmouseY mouseX mouseY |