+ 2

Building Sprites in JavaScript

(Sprites/JavaScript) could I save a photo to my desktop and use the saved name to define the sprite or would I need a web link?

1st Jul 2019, 8:58 AM
Benjamin S. Manicke
1 Resposta
+ 3
It depends on how you're deploying this website of yours. If all you care about is getting it to work on your laptop or desktop, saving to the file system will work. A URL can point at a file on your computer if the HTML is also loaded from the file system. If you want other people to see it over the Internet, the easiest thing to do is get your images on a web host somewhere and get a working URL for them. If this is for codes you want to share on Sololearn's Code Playground, you could also use base-64 encoding of your image data and embed the binary data into your HTML, or CSS. You can encode using a site like https://www.base64-image.de/. I used base 64 encoding for a little image in my code at https://code.sololearn.com/WiH4n0rrvD1B/ that shows after the fractal zoom animation completes. The base 64 string is in the CSS tab.
1st Jul 2019, 11:29 PM
Josh Greig
Josh Greig - avatar