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

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
Get step-by-step solutions from verified subject matter experts
