xxxxxxxxxx
// generative, bezier, curve, boolean, random, palette, array
// Mouse click to start again.
color palette[] = {
#281A16,
#434F35,
#7C643C,
#623012,
#B96828,
#9D3E16,
#D78F37,
#A58E60,
#E0CA4E,
#D9C693
};
float x, y, nextX, nextY, xAdj = 100, yAdj = 100;
boolean odd = true, firstTime = true;
void setup() {
size(1200, 550);
background(#281A16);
strokeWeight(1);
frameRate(20);
}
void draw() {
drawBezierVine(random(-50, width+50), height + random(10, 100));
stroke(150);
noFill();
rect(0, 0, width-1, height-1);
}
void drawBezierVine(float xIn, float yIn) {
if (firstTime) {
x = xIn;
y = yIn;
firstTime = false;
}
nextX = random(x-xAdj, x+xAdj);
nextY = random(y-yAdj, y-yAdj/3);
if (odd && random(1) < .5) {
noFill();
stroke(palette[int(random(10))]);
} else {
fill(palette[int(random(10))]);
stroke(palette[int(random(10))]);
}
bezier(x, y,
random(x-xAdj, nextX+xAdj),
random(y-yAdj, nextY+yAdj),
random(x-xAdj, nextX+xAdj),
random(y-yAdj, nextY+yAdj),
nextX, nextY);
if (!odd)line(x, y, nextX, nextY);
if (random(1) < .5) {
float x2 = random(x-xAdj, nextX+xAdj);
float y2 = random(y-yAdj, nextY+yAdj);
line(x, y, x2, y2);
fill(palette[int(random(10))]);
float sze = random(5, 15);
ellipse(x2, y2, sze, sze);
}
x = nextX;
y = nextY;
odd = !odd; // not odd == even
if (y < 0) {
firstTime = true;
}
}
void mousePressed() {
background(#281A16);
//background(palette[int(random(10))]);
firstTime = true;
}