Hello Everyone!
I have a quick question about the p5.js web editor. I’m trying to make a project that utilizes the p5.play library and I wanted to use the p5 web editor to do so. I imported the library file and referenced it in the html code, but I was unable to use the library.
Is there any official way to add libraries that I’m not aware about or is adding libraries just not supported in the web editor?
I’m a novice at p5.js, so go easy on me
1 Like
Hi @ChipAnyanwu.
In the index.html
file, add a script tag, with a link to the source code for the library.
e.g. This is the one for the p5.js sound library:
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/addons/p5.sound.min.js"></script>
The link can be a local one or it can be from somewhere else on the internet. I would just recommend using https://raw.githubusercontent.com/molleindustria/p5.play/master/lib/p5.play.js
for the p5.js play library.
1 Like
I added a script tag, and since I uploaded the library into the editor, referenced the path of the p5.play library. Does using the GitHub link for the file have a different effect?
No. It is just another way to link to the raw javascript of the library.