q5play
    Preparing search index...

    Function save

    • 🛠 Saves data to a file.

      If data is not specified, the canvas will be saved.

      If no arguments are provided, the canvas will be saved as an image file named "untitled.png".

      Parameters

      • Optionaldata: object

        canvas, image, or JS object

      • OptionalfileName: string

        filename to save as

      Returns void

      await Canvas(200);
      background(0.8);
      circle(0, 0, 50);

      q5.mousePressed = function () {
      save('circle.png');
      };
      await Canvas(200);
      background(0.8);
      text('save me?', -90, 0);
      textSize(180);
      let bolt = createTextImage('⚡️');

      q5.mousePressed = function () {
      save(bolt, 'bolt.png');
      };