Question: use the code ive made and add on to complete it. function setup() { createCanvas(800, 800); background(255); } function draw() { fill(255,0,0); noStroke(); square(1,0,30); //red

use the code ive made and add on to complete it.
function setup() {
createCanvas(800, 800);
background(255);
}
function draw() {
fill(255,0,0);
noStroke();
square(1,0,30);
//red
fill(255,140,0);
noStroke();
square(1,31,30);
//orange
fill(255,255,0);
noStroke();
square(1,63,30);
//yellow
fill(0,255,0);
noStroke();
square(1,95,30);
//green
fill(0,255,255);
noStroke();
square(1,126,30);
//cyan
fill(0,0,255);
noStroke();
square(1,157,30);
//blue
fill(255,100,255);
noStroke();
square(1,188,30);
//magenta
fill(100,60,0);
noStroke();
square(1,219,30)
//brown
fill(255);
noStroke();
square(1,250,30);
//white
fill(0);
noStroke();
square(1,281,30);
//black
}
use the code ive made and add on to complete it. function
setup() { createCanvas(800, 800); background(255); } function draw() { fill(255,0,0); noStroke(); square(1,0,30);

Write a P5 sketch that works as a simple paint program... Draw a blank canvas with a color palette at the left including red, orange, yellow, green, cyan, blue, magenta, brown, white, and black boxes. Let the user click and drag the mouse on the canvas to apply paint. Let the user click on the color palette boxes to set the paint color. You will need to use mousePressed or mouselsPressed to determine whether a click is happening, and if so use mouseX and mouseY to determine whether this click should apply paint to the canvas or change the paint color. Paint lines instead of points. For full credit, ensure that the palette always remains visible even if the user tries to paint overtop it. Let the user click and drag the mouse on the canvas to apply paint. Let the user click on the color palette boxes to set the paint color. You will need to use mousePressed or mouselsPressed to determine whether a click is happening, and if so use mouseX and mouseY to determine whether this click should apply paint to the canvas or change the paint color. Paint lines instead of points. For full credit, ensure that the palette always remains visible even if the user tries to paint overtop it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!