+ 12

Unable to Add Images to p5. [SOLVED]

Everytime I add an image it comes up with the 'CrossOrigin' error. That is annoying but easy to work through. When I find a good image that can embed, it now comes up with weird error that I can only translate is that the image is for CSS not canvas. The worst part is, I am re-using old images from other codes that worked fine. So why this isn't working is beyond me. Here is an example: https://code.sololearn.com/W6p426BU6IkS/?ref=app

27th May 2019, 7:42 AM
Clueless Coder
Clueless Coder - avatar
10 Answers
+ 8
your image() method under show() needs to start with a reference to the image. I think in this case sMan
27th May 2019, 7:56 AM
marjel101
marjel101 - avatar
+ 13
No, I mean the 'water' object. I applied 'tint' to the 'show' method but it is applying to the image rather than the rectangle. I will comment the issue on the code.
27th May 2019, 8:30 AM
Clueless Coder
Clueless Coder - avatar
+ 11
Thanks
27th May 2019, 8:10 AM
Clueless Coder
Clueless Coder - avatar
+ 9
marjel101 last thing, do you know why the 'tint' method only works on the image rather than the liquid?
27th May 2019, 8:22 AM
Clueless Coder
Clueless Coder - avatar
+ 9
Thanks for the answer.
27th May 2019, 9:37 AM
Clueless Coder
Clueless Coder - avatar
+ 8
May be Coder | Arb Rahim Badsa Helps you. They are great Coders in JS (p5)
28th May 2019, 4:31 AM
Rishabh Singh
Rishabh Singh - avatar
+ 8
Coder we're late😅
28th May 2019, 5:02 AM
Rishabh Singh
Rishabh Singh - avatar
+ 6
☕( ͡⚆ ͜ʖ ͡⚆)🐈 I think tint() is a method that can only be applied to images, not to other objects, and apparently it works globally on all images in your code, regardless of the location. If you want the pink rectangle to be transparent you better change the fill to include an alpha value, for instance fill(255,192,203,128) instead of using tint().
27th May 2019, 9:32 AM
marjel101
marjel101 - avatar
+ 5
Is liquid a p5 method? I don’t see it in the reference... https://p5js.org/reference/#group-Image
27th May 2019, 8:29 AM
marjel101
marjel101 - avatar