q5play
    Preparing search index...

    Function tint

    • 🌆 Applies a tint (color overlay) to the drawing.

      The alpha value of the tint color determines the strength of the tint. To change an image's opacity, use the opacity function.

      Tinting affects all subsequent images drawn. The tint color is applied to images using the "multiply" blend mode.

      Since the tinting process is performance intensive, each time an image is tinted, q5 caches the result. image will draw the cached tinted image unless the tint color has changed or the image being tinted was edited.

      If you need to draw an image multiple times each frame with different tints, consider making copies of the image and tinting each copy separately.

      Parameters

      • color: string | number

        tint color

      Returns void

      await Canvas(200);

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

      tint(1, 0, 0, 0.5);
      image(logo, -100, -100, 200, 200);