@ryleigh
In p5.js, you can style a rect using the following properties:
Here's an example of how you can style a rect in p5.js:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function setup() { createCanvas(400, 400); } function draw() { background(220); // Styling the rect fill('red'); // Set the fill color to red stroke('blue'); // Set the outline color to blue strokeWeight(2); // Set the thickness of the outline // Drawing the rect rect(50, 50, 100, 100); } |
In this example, we first set the fill color to red using the fill() function, the outline color to blue using the stroke() function, and specify the thickness of the outline to 2 using the strokeWeight() function. Finally, we draw a rect with a size of 100x100 at coordinates (50, 50) on the canvas.
You can experiment with different colors and stroke weights to style the rect according to your preferences.