In p5.js web editor, can I reuse an image from assets folder in several projects?

You could host on something like dropbox …

let img, url = 'https://dl.dropboxusercontent.com/s/35drk9bes8j0ups/train.png?dl=0';

function preload() {
  img = loadImage(url);
}

function setup() {
  createCanvas(img.width * 0.25, img.height * 0.25);
  img.resize(img.width * 0.25, img.height * 0.25);
}

function draw() {
  image(img, 0, 0);
}
2 Likes