Run a javascript function from p5.js or read a variable in the DOM

Unless I didn’t understand your problem, you can put your function directly in sketch.js, which is a javascript :slight_smile:

function setup() {
  createCanvas(400, 400);
  fill("white");
  var d = new Date();
  var n = d.getTimezoneOffset();
  text(d, 10, 10);
  text(n, 10, 30);
}
1 Like