q5play
    Preparing search index...

    Function createRadio

    • 📑 Creates a radio button group.

      Use the option(label, value) function to add new radio buttons to the group.

      Use the value property to get or set the value of the selected radio button.

      Parameters

      • OptionalgroupName: string

      Returns HTMLDivElement

      await Canvas(200, 160);

      let radio = createRadio();
      radio.option('square', '1');
      radio.option('circle', '2');

      q5.draw = function () {
      background(0.8);
      if (radio.value == '1') square(-40, -40, 80);
      if (radio.value == '2') circle(0, 0, 80);
      };