A simple p5.js and Processing add-on to let you use input. Just simply add to your code!
keysHeld
is a array (an ArrayList in Processing) with all the keys pressed stored in it.aKeyPressed
is detecting when a key is pressed (just a merge of keyPressed in processing and keyIsPressed in p5.js basically so your projects are easier to convert to p5.js/processing)theKey
is the last key pressed.keysLog
is a string containing all keys ever pressed.
Download the p5.input.js file and add
<script src="p5.input.js"></script>
to your code.
Copy and paste the processing.input.pde file to your code.
There is a demonstration of p5.input.js and how it works here, as well as a demonstration using a emulated Java/Processing Environment here. It is also shown on the p5js libraries site.