I'm trying to make a feature on my canvas where the user clicks a load button that allows them to load an image from any file on their computer, and load the image in to fill the canvas. I've included what I have so far below:
function loadTool() {
var img;
this.name = "loadTool";
this.icon = "assets/loadButton.png";
img = loadImage("assets/star.png");
this.draw = function() {
background(img, 0, 0);
}
}
I'm using the p5.js library. Rather than manually loading an image from loadImage, I'd like to allow the user to choose their own image saved on their computer, and fill the canvas with the image.