q5play
    Preparing search index...

    Function rect

    • 🧑‍🎨 Draws a rectangle or a rounded rectangle.

      Also accepts 8 parameters to specify a corner radius for each corner, in the order: top-left, top-right, bottom-right, bottom-left.

      Parameters

      • x: number

        x-coordinate

      • y: number

        y-coordinate

      • w: number

        width of the rectangle

      • h: number

        height of the rectangle

      • Optionalrounded: number

        radius for all corners

      Returns void

      await Canvas(200);
      background(0.8);

      rect(-70, -80, 40, 60);
      rect(-20, -30, 40, 60, 10);
      rect(30, 20, 40, 60, 20, 4, 0, 8);