p5.dom Library

This library can be quite tricky to use, but does provide some really interesting use cases. Although we may not actually explore this in class, you are welcome to check it out on your own.

Installing a Library

Since the p5.dom library is part of the default template, all we have to do is link to it in our HTML file.

Your HTML file might look something like this:

<!doctype html>
<html>
<head>
    <script src="js/p5.js">
    <script src="js/p5.dom.js">
    <script src="sketch.js">
</head>
<body>
</body>
</html>

Using the DOM Library

Demo

Show the code for practicing base changes?

Try This

Create a couple button elements, and some callback functions for when they are clicked.

Next Section - Object Oriented Programming