Pugmode26
Pugmode26

Reputation: 1

P5.js cursor() no images are loading when i put in file path

I grab a png image from online download it and then use cursor() and the put the file location inside the curve thing that's next to cursor, but the cursor doesn't change to the image and it does not say there's a error. How do I fix this? Here's my code not showing file location of file don't want people to know personal info.

function setup() {
  createCanvas(500, 900);
  strokeWeight(10);  
  cursor("");
}

function draw() {
  background(96, 166, 180);
  rect(250, 40, 150, 50);
}

Upvotes: 0

Views: 208

Answers (1)

TetroGem
TetroGem

Reputation: 46

Could you please add the file path you're using to your question? (With personal information censored of course, such as using a fake name but in place of where it is in the actual path)

The problem is most likely the location of your file, assuming that its just in your Downloads folder from your post. Make sure that your image is located inside the same source folder as your JS sketch, and then call it using a relative path instead of an absolute one. (Ex: "./images/example.png")

Upvotes: 1

Related Questions