ArrayList curtain; float theta; void setup() { size(400, 400); background(#542437); curtain = new ArrayList(); for (int x=-30; x < width; x +=8) { Strull strull = new Strull(x, theta); curtain.add(strull); theta += random(.15, .2); } } void draw() { background(#542437); noStroke(); //println(mouseX + ", " + mouseY); for (int i=0; i < curtain.size(); i++) { Strull stru = (Strull) curtain.get(i); stru.display(); } if (frameCount % 6 == 0 && frameCount<121) saveFrame("image-####.gif"); } void mouseClicked() { save(random(1234)+".jpg"); } class Strull { float x, h, marge, marge_y, t, theta; float r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12; Strull(float _x, float _theta) { x = _x; marge = 20; marge_y = 10; //fill(#C02942, 150 + random(50)); theta = _theta; r1 = random(marge/2); r2 = random(marge/2); r3 = random(marge/2); r4 = random(marge/2); r5 = random(marge, marge*2); r6 = random(marge, marge*2); r7 = random(marge, marge*2); r8 = random(marge, marge*2); r9 = 100+random(marge_y); r10 = 250+random(marge_y); r11 = 200+random(marge_y); r12 =80+random(marge_y) ; } void display() { noFill(); stroke(#C02942, 180); t = map(sin(theta), -1, 1, -marge/2, marge); h = map(cos(theta),-1,1,.85,.9); beginShape(); curveVertex(x, 0); curveVertex(x + r1, 0); curveVertex(x + r2 +t, r9); curveVertex(x + r3-t/2, r10); curveVertex(x + t/2, height*h); curveVertex(x + r5- t/2, height*h); curveVertex(x + r6-t/2, r11); curveVertex(x + r7+t, r12); curveVertex(x + r8, 0); curveVertex(x + r8, 0); endShape(CLOSE); theta -= .0523; } }