Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
p5js-interaction [2024/02/21 23:46] renickp5js-interaction [2024/02/21 23:58] renick
Line 104: Line 104:
 <iframe src="https://editor.p5js.org/renick/full/jdci35yJq" width=99% height=800></iframe> <iframe src="https://editor.p5js.org/renick/full/jdci35yJq" width=99% height=800></iframe>
 </HTML> </HTML>
 +
 +===== doing something while a key is down =====
 +
 +Above, we stored key presses. We can also do something based on whether a certain key is pressed. The keyIsDown function returns either 'true' or 'false', so we can use that in an if-statement to control the behaviour of our program:
 +
 +<HTML>
 +<iframe src="https://editor.p5js.org/renick/full/SiRrljdNQ" width=99% height=800></iframe>
 +</HTML>
 +
 +Read more about the keyIsDown function here: https://p5js.org/reference/#/p5/keyIsDown
  
 ===== using mouse and keyboard events outside of p5js ===== ===== using mouse and keyboard events outside of p5js =====
  
  
  • p5js-interaction.txt
  • Last modified: 4 months ago
  • by renick