I have a quick question. I would allow my sketch’s users to drag and drop an image file into the program window, and then use it. I can’t find any function for that in p5.js. What would be the easiest way to do that in your opinion ?
Thanks for you help !
I made a quick example below
var file;
function draw() {
if (file==null) dropScreen();
else image(file, 0, 0, width, height);
}
function dropScreen() {
textAlign(CENTER,CENTER);
text("drag your file here",width/2, height/2);
//if (fileIsDroped) file=imageDroped;
}
Thank you for your response ! I’m actually using Waterfox, but for this project I want my sketch to run on the p5 online editor, (it will be for a creative workshop with kids).
Is there a way to make this kind of function works there ?