q5play
    Preparing search index...

    Function set

    • 🌆 Sets a pixel's color in the image or canvas. Color mode must be RGB.

      Or if a canvas or image is provided, it's drawn on top of the destination image or canvas, ignoring its tint setting.

      Run updatePixels to apply the changes.

      Not applicable to WebGPU canvases.

      Parameters

      • x: number
      • y: number
      • val: any

        color, canvas, or image

      Returns void

      await Canvas(200);
      noSmooth();
      let c = color('lime');
      let img = createImage(50, 50);

      q5.draw = function () {
      img.set(random(50), random(50), c);
      img.updatePixels();
      background(img);
      };