Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PATTERNS - pattern-04
- //********************************************************************************************
- // iomikron.tumblr.com - You can use and modify this software for free. Sharing your code with
- // others is highly recommended. Please credit me, keeping these lines of comments.
- //********************************************************************************************
- int numOfRows = 17;
- int numOfColumns = 42;
- int numOfItems = numOfColumns*numOfRows;
- int counter = 0;
- int imageCounter = 0;
- Triangle trg;
- float[] omega01 = new float[numOfItems];
- float[] amp01 = new float[numOfItems];
- float[] phase01 = new float[numOfItems];
- float[] opacity01 = new float[numOfItems];
- float[] omega02 = new float[numOfItems];
- float[] amp02 = new float[numOfItems];
- float[] phase02 = new float[numOfItems];
- float[] opacity02 = new float[numOfItems];
- float d1, d2, initX, initY, t;
- void setup()
- {
- size(600, 500);
- d1 = 3.;
- d2 = 3.;
- initX = 25.;
- initY = 25.;
- trg = new Triangle();
- for(int i = 0; i < numOfRows; i++)
- {
- for(int j = 0; j < numOfColumns; j++)
- {
- omega01[counter] = random(25, 35);
- amp01[counter] = random(150, 180);
- phase01[counter] = random(1, 2*PI);
- opacity01[counter] = random(10, 255);
- omega02[counter] = random(25, 35);
- amp02[counter] = random(150, 180);
- phase02[counter] = random(1, 2*PI);
- opacity02[counter] = random(10, 255);
- counter ++;
- }
- }
- }
- void draw()
- {
- background(200);
- counter = 0;
- for(int i = 0; i < numOfColumns; i ++)
- {
- for(int j = 0; j < numOfRows; j++)
- {
- noStroke();//stroke(color(255, 0, 0), opacity01[counter]);
- fill(amp01[counter]*cos(omega01[counter]*t + phase01[counter])+ 100,
- opacity01[counter]);
- trg.Display01(initX + i*(trg.W + d1),
- initY + j*(trg.H + 2*d2));
- noStroke();//stroke(color(255, 0, 0), opacity[i]);
- fill(amp02[counter]*cos(omega02[counter]*t + phase02[counter])+ 100,
- opacity02[counter]);
- trg.Display02(initX + i*(trg.W + d1),
- initY + j*(trg.H + 2*d2) + d2);
- counter ++;
- }
- }
- t += 0.003;
- // noLoop();
- }
- class Triangle
- {
- float W = 10.;
- float H = 20.;
- void Display01(float x1, float y1)
- {
- quad(x1, y1,
- x1 + W, y1 + H/2,
- x1, y1 + H,
- x1, y1 + H
- );
- }
- void Display02(float x1, float y1)
- {
- quad(x1, y1 + H,
- x1 + W, y1 + H/2,
- x1 + W, y1 + H + H/2,
- x1 + W, y1 + H + H/2
- );
- }
- }
- void mouseReleased()
- {
- imageCounter ++;
- save("image" + str(imageCounter) + ".png");
- }
Advertisement
Add Comment
Please, Sign In to add comment