Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int howMany = 15;
- float step, edge, theta, x;
- ExLine [] Elem = new ExLine[howMany];
- ExLine [] Elem2 = new ExLine[howMany];
- ExLine [] Elem3 = new ExLine[howMany];
- void setup() {
- size(500, 400);
- x = 0;
- edge = width/10;
- step = (width-2*edge)/howMany;
- theta = 0;
- for (int i = 0; i < Elem.length; i++) {
- x = i*step;
- Elem[i]= new ExLine(x, 0+theta, edge,1,1);
- Elem2[i]= new ExLine(x, PI/2+theta, edge,.9,.9);
- Elem3[i]= new ExLine(x, PI+theta, edge,.8,.8);
- theta += PI/howMany;
- }
- }
- void draw() {
- background(#0D3F40);
- for (int i = 0; i < Elem.length; i++) {
- Elem[i].display();
- Elem2[i].display();
- Elem3[i].display();
- }
- if (frameCount % 2 == 0 && frameCount < 121) saveFrame("image-####.gif");
- }
- class ExLine {
- float x, x2, y, y2, ymin, ymax;
- float rad, theta, edge;
- ExLine(float _x, float _theta, float _edge, float _ymin, float _ymax) {
- x = _x;
- y = height*.6;
- rad = 70;
- theta = _theta;
- edge = _edge;
- ymin = -30*_ymin;
- ymax = -120*_ymax;
- }
- void display() {
- fill(255,50);
- stroke(255,100);
- y2= map(sin(theta), -1, 1, ymin, ymax);
- x2 = map(sin(theta), -1, 1, step*.4, step*.9);
- rect(x+edge, y, x2, y2);
- theta += .0523;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement