+ 4

No background image in code playground

I have tried multiple ways to get a background image to produce from a url. I was able to link p5.js scripts on the HTML tab using urls, and they run fine. I have tried different methods of entry and multiple image addresses without success. Am i missing something, or is that a limitation of the "playground environment" I have tried: CSS body { background-image: url(" VARIOUS ADDRESSES "); } HTML HEAD <style> body { background-image: url(" VARIOUS ADDRESSES "); } </style> HTML body <body style="background-image:url(' VARIOUS ADDRESSES ');"> JS The p5.js preload() described here: https://p5js.org/reference/#/p5/preload This produces an "Access_Control_Allowe_Origin" error. I just thought about makeing a button with an onclick event to change try to change it. I'll be trying that next. All comments are appreciated!

8th Apr 2019, 1:03 AM
Ryan James
Ryan James - avatar
5 ответов
+ 2
It must be because my phone was not copying the links correctly (insert confusion here) I used my pc to get the links and it worked fine
8th Apr 2019, 1:26 AM
Ryan James
Ryan James - avatar
+ 2
You definitely do not need p5.js to just get a background image working. Can you show us the full code you are working on?
8th Apr 2019, 1:10 AM
Fermi
Fermi - avatar
+ 2
I'm using p5.js to construct a countdown timer https://code.sololearn.com/Wi34qqIsyrRs/?ref=app That is the original code i shared and have since been trying to put a background on. The only changes missing are a clear() function in the JS tab, within the draw() function, and making the background transparent with rgba(0,0,0,0) And all my various placements of background code. Thanks for the reply.
8th Apr 2019, 1:19 AM
Ryan James
Ryan James - avatar
+ 1
Yeah lol, it's working fine for me too. Just letting you know!
8th Apr 2019, 1:27 AM
Fermi
Fermi - avatar
+ 1
Thanks you for verifying!
8th Apr 2019, 1:29 AM
Ryan James
Ryan James - avatar