Font size
WorksheetsP5 Editor
Total questions: 20
Worksheet time: 11mins
What is p5.js ?
It is a header file
It is programming language
It is a Javascript library
It is an online compiler
Which function in p5 is executed only once?
draw()
rect()
setup()
createCapture()
What function do we use to create circle?
ellipse()
line()
arc()
circle()
What is a correct code to create a rectangle in p5.js?
rect();
rectangle(20,20,40,50);
rect(40,120,120,40);
rect(40,120);
What function do we use to add color to a shape in p5.js?
color();
fill();
paint();
noFill();
Which are correct ways to add color to a shape in p5.js?
fill(‘yellow’);
fill(amarillo);
fill(255,255,0);
fill(‘#ebe12d’);
Which code sets the canvas' color to "pink" in p5.js?
background-color('pink');
bg('pink');
background('pink');
bg-color('pink');
______________ are lines of code that perform specific tasks.
Variables
Functions
Loops
Conditionals
__________________ are the values inside of the parentheses following the name of the function. These values will be different based on the information that the function needs.
Variables
Function
Arrays
Parameters
What, is the difference between function setup () and function draw()?
Function setup is a loop and function draw only runs once.
There are no differences.
Function setup runs once and function draw is a loop.
Function setup and function draw are both loops but they allow the programmer to do different things.
How many parameters are there in the code for drawing a line in p5.js?
4
2
3
5
mouseX and mouseY are variables that represent...
The location of the mouse on the X and Y axis.
The location of your drawing on the x and y axis.
The size of the canvas.
NONE
RGB, colors range from ___ to ___.
0 - 100
0 - 255
0 - 250
50 - 550
The area where all drawn graphics are displayed is known as the...
console
drawing area
canvas
pallete
Which of the following is an example of a built in variable in P5.js?
background
width
varX
mouse
What is the y coordinate of the following ellipse?
ellipse(70, 120, 150, 180);
70
120
150
180
What are the parameters in the 'createCanvas' function?
No parameters
x and y coordinates
color of the canvas
width and height
You can use the 'random' function to randomly select the values for any function that uses numeric parameters.
True
False
When using 'RGB' to fill the color of a shape, the 4th parameter 'a' controls the __________ of the color.
stroke
weight
transparency
size
Name the different ml5 libraries used by you in the projects made in class.
