Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int howMany = 15;
- float step, edge;
- ExLine [] Elem = new ExLine[howMany];
- void setup() {
- size(500, 400);
- background(#2C3E50);
- noStroke();
- float x = 0;
- float theta = 0;
- edge = width/10;
- step = (width-2*edge)/howMany;
- for (int i = 0; i < Elem.length; i++) {
- x = i*step;
- Elem[i]= new ExLine(x, theta);
- theta += PI/howMany;
- }
- }
- void draw() {
- background(#2C3E50);
- for (int i = 0; i < Elem.length; i++) {
- Elem[i].display();
- }
- }
- class ExLine {
- float x, x2, y, y2;
- float rad, theta;
- ExLine(float _x, float _theta) {
- x = _x;
- y = height*.6;
- rad = 70;
- theta = _theta;
- }
- void display() {
- y2= map(sin(theta), -1, 1, -30, -120);
- 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