Hi there,
I’m fairly new to Processing, and have been trying to make a single arc with a gradient style.
I tried searching around, but have only found gradient codes for straight line objects, such as rectangle, the full canvas, etc. Since I’m trying to make a “curve”, I’ve been struggling to use LerpColor to make it happen.
Any Ideas on how to handle?
So far I’ve come up only with this:
var c1;
var c2;
function setup() {
createCanvas(600,600);
c1 = color(0,0,0);
c2 = color(255,255,55);
angleMode(DEGREES);
}
function draw() {
background(15,15,15);
translate(width/2,height/2);
setGradient(0,0,25,25,c1,c2);
}
function setGradient(x,y,w,h,c1,c2){
noFill();
for (var i = 0; i < 360; i++){
var colormap = map(i,0,360,0,1);
var strokeC = lerpColor(c1,c2,colormap);
x = 150 * cos(i);
y = 150 * sin(i);
stroke(strokeC);
ellipse(x,y,w,h);
}
}