q5play
    Preparing search index...

    Function mouseWheel

    • 🖲 Define this function to respond to mouse wheel events.

      event.deltaX and event.deltaY are the horizontal and vertical scroll amounts, respectively.

      Return true to allow the default behavior of scrolling the page.

      Parameters

      • event: any

      Returns void

      let x = 0;
      let y = 0;
      q5.draw = function () {
      circle(x, y, 10);
      };
      q5.mouseWheel = function (e) {
      x += e.deltaX;
      y += e.deltaY;
      return false;
      };