I have a code to map out colours in order to create a radial gradient in a circle. Right know it's going from black to white. How can I switch up the colours, and use other values? I have tried to create values for different colours but it's not working. Does anyone knows how to do it? Here's the piece of code:
// function to draw the gradient
void desenhar_grad(float posX, float posY, int raio) {
pushStyle();
noStroke();
for (int r = raio; r > 0; r--) {
int tom = round(map(r, raio, 0, 255, 0)); // the last 2 values are the colours. first is the center, second is the exterior
fill(tom);
circle(posX, posY, r * 2);
}
popStyle();
}