Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- }
- class Strull {
- float x, 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);
- beginShape();
- curveVertex(x, 0);
- curveVertex(x + r1, 0);
- curveVertex(x + r2 +t, r9);
- curveVertex(x + r3-t/2, r10);
- curveVertex(x + r4+ t/2, height*.85);
- curveVertex(x + r5- t/2, height*.85);
- curveVertex(x + r6-t/2, r11);
- curveVertex(x + r7+t, r12);
- curveVertex(x + r8, 0);
- curveVertex(x + r8, 0);
- endShape(CLOSE);
- theta -= .0523;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement