Adding Libraries to p5.js
p5.js
Introduction
When we wish to use some feature that is not directly available in p5.js
, say for example creating Voronoi Tesselations using the c2.js library, then we need to import that JavaScript library into our p5.js
session that allows us to do that.
Simple Instructions!
- On your
p5.js
web editor, click the arrow on the left side and access theindex.html
file.
Paste that
<script>
tag and its contents into yourindex.html
.The library will now be available in your
sketch.js
and you can use the commands and features from that library therein.
Here is a shortish video that tells us how to do this:
References
- p5.js Documentation: How to use a JS library in your p5.js sketch. https://archive.p5js.org/libraries/
- p5.js Community Libraries. https://p5js.org/libraries/
- jsDeliver https://www.jsdelivr.com/?query=p5play
- cdnJS.https://cdnjs.com