Search Header Logo
2.5.2 - Key Presses in P5.js

2.5.2 - Key Presses in P5.js

Assessment

Presentation

Computers

10th Grade

Medium

Created by

Ryan Paul

Used 5+ times

FREE Resource

4 Slides • 8 Questions

1

Key Press Tutorial

Open this link then click on the next slide

2

Labelling

Place the choices to the right of the correct spot.

Drag labels to their correct position on the image

declares the variable

initializes the variable

uses the variable

3

Dropdown

Question image
Line #1 ​
the variable to hold the ​
for the upper left circle.



Line # 5 ​
the color variable to give a starting off value.



Line #11 replaces 255 with ​
.

4

media

Add what we just did to your code

5

Drag and Drop

if( ​
&& key == '​
'){

cCol1 = color(​
) //red}

Drag these tiles and drop them in the correct blank above
keyIsPressed
r
255, 0, 0
mouseClicked
b
100, 100, 100
keyPressed
c
0, 0, 255

6

Multiple Choice

Question image

What does pressing the 'g' key on the keyboard do?

1
It rotates the object 90 degrees.
2
It increases the size of the object.
3
It changes the color of the object to blue.
4
It changes the color of the object to green.

7

Edit your code

media

​Add another keypress to turn the circle blue

8

Poll

How comfortable are you with using "keyIsPressed" in your code?

👎

I definitely need help

👌

I feel OK

👍

I know how it works

9

Reorder

All code snippets below accomplish the same task, but with different levels of efficiency.

Rank them in the order of least efficient code to most efficient.

1
2
3

10

Open Ended

Question image

Why is code snippet 2 more efficient than code snippet 1?

11

Open Ended

Question image

Why is code snippet 3 more efficient than code snippet 2?

12

Complete the rest of the assignment

Key Press Tutorial

Open this link then click on the next slide

Show answer

Auto Play

Slide 1 / 12

SLIDE