q5play
    Preparing search index...

    Function opacity

    • 💅 Sets the global opacity, which affects all subsequent drawing operations, except background. Default is 1, fully opaque.

      In q5 WebGPU this function only affects images.

      Parameters

      • alpha: number

        opacity level, ranging from 0 to 1

      Returns void

      await Canvas(200);
      background(0.8);

      opacity(1);
      circle(-20, -20, 80);

      opacity(0.2);
      square(-20, -20, 80);