xxxxxxxxxx
p5.prototype.linearGradient = function(x0, y0, x1, y1, c1, c2) {
let ctx = this.drawingContext;
let gradient = ctx.createLinearGradient(x0, y0, x1, y1);
gradient.addColorStop(0, c1);
gradient.addColorStop(1, c2);
ctx.fillStyle = gradient;
};
function setup() {
createCanvas(400, 400);
// Call the custom method to draw a linear gradient
linearGradient(0, 0, width, height, 'red', 'blue');
circle(200, 200, 300)
fill(255)
rect(250, 250, 50)
}