q5play
    Preparing search index...

    Function Canvas

    • ⭐ Creates a canvas element, a section of the screen your program can draw on.

      Run this function to start using q5!

      Note that in this example, the circle is located at position [0, 0], the origin of the canvas.

      Parameters

      • Optionalw: number

        width or side lengths of the canvas

      • Optionalh: number

        height of the canvas

      • Optionaloptions: object

      Returns Promise<HTMLCanvasElement>

      canvas element

      await Canvas(200, 100);
      background('silver');
      circle(0, 0, 80);