Hello,
I need help to change the colors!
i am trynig to make a differents objects like a rect, circle, triangle, blink/flash with diferent colors, I am till now, can do it with black and white. As the code below i show this happenig… Also i added a “mousePressed drawing” but the drawins only stay under of all… Thats wy i leaved a blanck space, so you will se how it works.
Sorrry if do not been clear about what i need. … But, lets do it… Thanks
I did try this, as some one told me on other topic.
int m = millis();
fill(m % 125);
println(m%444); // This is your color! ** but no changes**
circle(100, 100, 100);
//String[] sentences={"VrtX_@rT"};
float xRed = 62, xGreen = 20, xBlue = 173;
float yRed = 207, yGreen = 1, yBlue = 106;
boolean backwards=false;
int timeLapse=400;
int timeTrack;
int angle = 0;
PShader blur;
void setup() {
size(800, 800);
background(102);
noStroke();
fill(0, 102);
timeTrack=millis()+timeLapse;
blur = loadShader("blur.glsl");
}
void draw() {
int m = millis(); // start flash rec
fill(m % 150);
rect(25, 25, 555, 355); // end ret flash
int m1 = millis();
fill(m1 % 200);
circle(520,184, 220);
int m2 = millis();
fill(m2 % 250);
triangle(120, 750, 232, 450, 344, 750);
//Next inverts diretion o ellipse colors
if (millis()>timeTrack) {
timeTrack=millis()+timeLapse;
backwards=!backwards;
}
float per = (timeTrack-millis())/float(timeLapse);
if (backwards==true) {
per = 1-per;
}
surface.setTitle(nf(per*100, 3, 2)+"% Flag="+backwards);
fill(lerpColor(color(xRed, xGreen, xBlue), color(yRed, yGreen, yBlue), per));
ellipse(width/2, height/2, 300, 300);
//End ellipse code
int m4 = millis();
fill(m4 % 200);
circle(520,520, 120);
// Start Drawing on canva with the mouse pressed
if (mousePressed == true) {
angle += 5;
float val = cos(radians(angle)) * 12.0;
for (int a = 0; a < 360; a += 75) {
float xoff = cos(radians(a)) * val;
float yoff = sin(radians(a)) * val;
fill(0);
ellipse(mouseX + xoff, mouseY + yoff, val, val);
}
fill(255);
ellipse(mouseX, mouseY, 2, 2);
// Drwaing on canva code
}
}
This is a simple one, clear one
int angle = 0;
void setup()
{
size(600, 200);
background(102);
noStroke();
fill(0, 102);
}
void draw()
{
// background(100);
int m = millis();
fill(m % 125);
println(m%444); // This is your color!
circle(100, 100, 100);
int m1 = millis();
fill(m1 % 425); // This will not be applied because a fill() follows it!
fill(211, 61, 242); // purple This is the fill() applied to the circle.
circle(300, 100, 100);
int m2 = millis();
fill(m2 % 225);
//fill(61, 123, 242); // blue - this is off, its wy flash.I i take // off just stay blue
circle(500, 100, 100);
if (mousePressed == true) {
angle += 5;
float val = cos(radians(angle)) * 12.0;
for (int a = 0; a < 360; a += 75) {
float xoff = cos(radians(a)) * val;
float yoff = sin(radians(a)) * val;
fill(0);
ellipse(mouseX + xoff, mouseY + yoff, val, val);
}
fill(255);
ellipse(mouseX, mouseY, 2, 2);
}
//println(millis());
}