q5play
    Preparing search index...

    Function textAlign

    • 📘 Sets the horizontal and vertical alignment of text.

      Alignment constants like CENTER can be used with this function.

      Parameters

      • horiz: "left" | "center" | "right"

        horizontal alignment

      • Optionalvert: "top" | "middle" | "bottom" | "alphabetic"

        vertical alignment

      Returns void

      await Canvas(200);
      background(0.8);
      textSize(32);

      textAlign(CENTER, CENTER);
      text('Hello, world!', 0, 0);