q5play
    Preparing search index...

    Function capsule

    • 🧑‍🎨 Draws a capsule.

      Parameters

      • x1: number

        x-coordinate of the first point

      • y1: number

        y-coordinate of the first point

      • x2: number

        x-coordinate of the second point

      • y2: number

        y-coordinate of the second point

      • r: number

        radius of the capsule semi-circle ends

      Returns void

      await Canvas(200, 100);
      background(0.8);
      strokeWeight(5);
      capsule(-60, -10, 60, 10, 10);
      q5.draw = function () {
      background(0.8);
      fill('cyan');
      strokeWeight(10);
      capsule(0, 0, mouseX, mouseY, 20);
      };