Static p5_sys::global::createWriter[][src]

pub static createWriter: CreateWriterInternalType
Expand description

No description available

Examples

function setup() {
  createCanvas(100, 100);
  background(200);
  text('click here to save', 10, 10, 70, 80);
}

function mousePressed() {
  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
    const writer = createWriter('squares.txt');
    for (let i = 0; i < 10; i++) {
      writer.print(i * i);
    }
    writer.close();
    writer.clear();
  }
}

Parameters

name name of the file to be created

extension?