function getMousePos(canvas, w, h, evt) {
  if (evt && !evt.clientX) { // use touches if touch and not mouse
    if (evt.touches) {
      evt = evt.touches[0];
    } else if (evt.changedTouches) {
      evt = evt.changedTouches[0];
    }
  }
  var rect = canvas.getBoundingClientRect();
  var sx = canvas.scrollWidth / w;
  var sy = canvas.scrollHeight / h;
  return {
    x: (evt.clientX - rect.left) / sx,
    y: (evt.clientY - rect.top) / sy,
    winX: evt.clientX,
    winY: evt.clientY,
    id: evt.identifier
  };
}
The mouseMoved() function is called every time the mouse moves and a mouse
button is not pressed.<br><br>
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.

@method mouseMoved
@example
<div>
<code>
// Move the mouse across the page
// to change its value

var value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function mouseMoved() {
  value = value + 5;
  if (value > 255) {
    value = 0;
  }
}
</code>
</div>

<div class="norender">
<code>
function mouseMoved() {
  ellipse(mouseX, mouseY, 5, 5);
  // prevent default
  return false;
}
</code>
</div>

@alt
black 50x50 rect becomes lighter with mouse movements until white then resets
no image displayed