Hi there
I want to make a picture as the picture attached.
I have found a Code about gradients that I wanted to use, but I dont understand anything
I would like to know what I need to change to use another colors and to Move the core of the diferent colors. Can you please help me?
</>
float redX;
float redY;
float redXSpeed;
float redYSpeed;
float greenX;
float greenY;
float greenXSpeed;
float greenYSpeed;
float blueX;
float blueY;
float blueXSpeed;
float blueYSpeed;
void setup() {
size(256, 256);
noSmooth();
redX = random(width);
redY = random(height);
redXSpeed = random(-1, 1);
redYSpeed = random(-1, 1);
greenX = random(width);
greenY = random(height);
greenXSpeed = random(-1, 1);
greenYSpeed = random(-1, 1);
blueX = random(width);
blueY = random(height);
blueXSpeed = random(-1, 1);
blueYSpeed = random(-1, 1);
}
void draw() {
redX += redXSpeed;
redY += redYSpeed;
if (redX < 0 || redX > width) {
redXSpeed *= -1;
}
if (redY < 0 || redY > height) {
redYSpeed *= -1;
}
greenX += greenXSpeed;
greenY += greenYSpeed;
if (greenX < 0 || greenX > width) {
greenXSpeed *= -1;
}
if (greenY < 0 || greenY > height) {
greenYSpeed *= -1;
}
blueX += blueXSpeed;
blueY += blueYSpeed;
if (blueX < 0 || blueX > width) {
blueXSpeed *= -1;
}
if (blueY < 0 || blueY > height) {
blueYSpeed *= -1;
}
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float redDistance = dist(x, y, redX, redY);
float greenDistance = dist(x, y, greenX, greenY);
float blueDistance = dist(x, y, blueX, blueY);
stroke(redDistance, greenDistance, blueDistance);
point(x, y);
}
}
}
</>