Mouse position determines grey level. Keys 1, 2, 3, ..., 9 change the line style.
A port of P_4_3_1_01.pde in Generative Programming book from Processing to p5.js.
xxxxxxxxxx
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.13/p5.min.js"></script>
<!-- uncomment lines below to include extra p5 libraries -->
<!--<script language="javascript" src="../addons/p5.dom.js"></script>-->
<!--<script language="javascript" src="../addons/p5.sound.js"></script>-->
<script language="javascript" src="P_4_3_1_01.js"></script>
<!-- this line removes any default padding and style. you might only need one of these values set. -->
<style> body {padding: 0; margin: 0;} </style>
</head>
<body>
</body>
https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.13/p5.min.js