xxxxxxxxxx
float x, y; //x = abscisse, y = ordonnée des courbes créées
int ran;
int run;
int a; //taille des ellipses
int d; //couleur
int e; //couleur
int f; //couleur
PGraphics buf;
void setup() {
size(1240, 874); // A5 paysage 150 dpi
buf = createGraphics(1240, 874); //création d'un buffer (avec les deux courbes générées)
}
void draw() {
buf.beginDraw();
buf.background(255);
// Votre code commence ici!
ran = int(random(4, 20));
run = int(random(4, 20));
d= 255;
e= int(random(0,40));
f= int(random(100,150));
buf.beginShape(); //courbe 1
buf.noStroke();
buf.fill(e, e, e, 200);
buf.vertex(0, height);
for (float x = 0; x < width; x += ran) {
y = height - ((1.1*x)+300*cos(x));
buf.vertex(x, y);
}
buf.vertex(width, height);
buf.endShape();
buf.beginShape(); //courbe2
buf.noStroke();
buf.fill(f, f, f, 200);
buf.vertex(0, width);
for (float x = 0; x < width; x += run) {
y =((1.1*x)+300*cos(x));
buf.vertex(x, y);
}
buf.vertex(width, height);
buf.endShape();
buf.endDraw();
a = int(random(10, 30));
image(buf, 0, 0);
for(int x = 0; x< width; x= x + /*dim*/ 30) {
for(int y=0; y<height; y = y + /*dim*/ 30) {
color c = buf.get(x,y);
float mod = (255-brightness(c))/30;
fill(c);
noStroke();
ellipse(x,y,a,a);
}
}
marges();
noLoop();
}
void keyPressed() {
if (key == ' ') redraw();
if (key == 's') saveFrame();
}
void marges() {
colorMode(RGB);
fill(255);
stroke(255);
rect(0, 0, width, 24); // haut
rect(0, height-24, width, 24); // bas
rect(0, 0, 24, height); // gauche
rect(width-24, 0, 24, height); // droite
}