This lesson introduces students to interactivity, the ability of a computer to respond to user input. Students explore and reflect on examples of interactive sketches that respond to mouse movement, mouse clicks, and pressed keyboard keys.
Students will be able to:
This lesson teaches students how to develop interactive sketches that respond to user input from the mouse, including mouse movement and mouse clicks.
Students will be able to:
mouseX
system variable to keep track of the current horizontal position of the cursormouseY
system variable to keep track of the current vertical position of the cursormouseButton
system variable to check whether the mouse is left, right, or center clickedThis lesson teaches students how to develop interactive sketches that respond to user input from the keyboard. Students also explore how key codes are used to represent physical keys on the keyboard and use them in their sketches.
Students will be able to:
keyIsPressed
system variable to create interactive p5.js sketches that respond to any pressed keykeyIsDown()
function to create interactive p5.js sketches that respond to a specific key being pressed