q5play
    Preparing search index...

    Function image

    • 🌆 Draws an image or video frame to the canvas.

      Parameters

      • img: Image | HTMLVideoElement

        image or video to draw

      • dx: number

        x position to draw the image at

      • dy: number

        y position to draw the image at

      • Optionaldw: number

        width of the destination image

      • Optionaldh: number

        height of the destination image

      • Optionalsx: number

        x position in the source to start clipping a subsection from

      • Optionalsy: number

        y position in the source to start clipping a subsection from

      • Optionalsw: number

        width of the subsection of the source image

      • Optionalsh: number

        height of the subsection of the source image

      Returns void

      await Canvas(200);

      let logo = load('/q5js_logo.avif');

      q5.draw = function () {
      image(logo, -100, -100, 200, 200);
      };
      await Canvas(200);

      let logo = load('/q5js_logo.avif');

      q5.draw = function () {
      image(logo, -100, -100, 200, 200, 256, 256, 512, 512);
      };