Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
p5js-interaction [2024/02/22 00:29] – renick | p5js-interaction [2024/03/13 07:47] (current) – renick | ||
---|---|---|---|
Line 16: | Line 16: | ||
p5js also has some functions that deal with mouse position relative to the previous frame, including detecting mouse movement, mouse dragging, and whether the left button is pressed. There' | p5js also has some functions that deal with mouse position relative to the previous frame, including detecting mouse movement, mouse dragging, and whether the left button is pressed. There' | ||
- | ====== tracking the mouse ====== | + | ===== tracking the mouse ===== |
In the following example, we make a box follow the mouse. | In the following example, we make a box follow the mouse. | ||
Line 107: | Line 107: | ||
===== doing something while a key is down ===== | ===== 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 ' | + | Above, we stored key presses. We can also do something based on whether a certain key is pressed. The keyIsDown function returns either ' |
< | < | ||
Line 114: | Line 114: | ||
Read more about the keyIsDown function here: https:// | Read more about the keyIsDown function here: https:// | ||
+ | |||
+ | You can find all of the key codes here: https:// | ||
===== more about mouse and keyboard in p5js ===== | ===== more about mouse and keyboard in p5js ===== | ||
- | For more on mouse and keyboard interaction in p5js, see the ' | + | For more on mouse and keyboard interaction in p5js, see the ' |
===== using mouse and keyboard events outside of p5js ===== | ===== using mouse and keyboard events outside of p5js ===== |