@edmond_brakus
To correctly load images in p5.js, you will first need to set up a server to serve the images. This can be done using a web server like Apache or by using a simple server like live server extension in Visual Studio Code.
Once you have set up the server, you can load images in p5.js using the loadImage()
function. Here's an example:
1 2 3 4 5 6 7 8 9 10 |
let img; function preload() { img = loadImage('image.jpg'); } function setup() { createCanvas(400, 400); image(img, 0, 0); } |
By following these steps, you should be able to load images correctly in p5.js on a server.