Worksheetsp5.js - shape, color, syntax
Total questions: 19
Worksheet time: 17mins
What is a function?
A toaster
Lines of code that perform specific tasks
Input
Kale Chip
What are some shapes we can create with p5.js?
Rectangle
Circle
Dog
Triangle
What is a correct code to create a rectangle in p5.js?
rectangle(40,120);
rect(40,120,120,40);
rectangle(40,120,120,40);
rect();
How do I create a rectangle located 50px to the right and 80px down on the canvas?
rect(40,100,80,50);
rect(100,40,50,80);
rect(80,50,100,40);
rect(50,80,100,40);
What function do we use to add color to a shape in p5.js?
fill();
color();
colorize();
paint();
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 makes an ellipse measuring 140px width and 100px height?
ellipse(175, 130, 100, 140);
circle(175, 130, 140, 100);
ellip(175, 130, 140, 100);
ellipse(175, 130, 140, 100);
Which code sets the canvas' color to "pink" in p5.js?
background-color('pink');
background('pink');
bg('pink');
bg-color('pink');
Hint: line(x1,y1,x2,y2)
What is the height of the following ellipse?
ellipse(70, 120, 150, 180);
Which of the following would create a blue fill?
fill(255, 255, 255);
fill(255, 0, 0);
fill(0, 255, 0);
fill(0, 0, 255);
What x and y coordinates would you use to center a circle on a canvas that is 400 by 400 pixels?
(100, 100)
(200, 200)
(300, 300)
(400, 400)
What number would you change to move the y position of this rectangle?
20 (the first argument)
30 (the second argument)
100 (the third argument)
150 (the fourth argument)
How do you remove the outline on a shape?
nofill()
NoFill()
dontFill()
noFill()
How do we fill a shape with green?
fill("green")
fill(255, 0, 0)
fill(0, 255, 0)
fill(verde)
