Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num = 3;
- Thingie[] myThing = new Thingie[num];
- int vLines = 10;
- float space;
- float oy;
- float segment, margin;
- void setup() {
- size(500, 450);
- background(0);
- stroke(255);
- oy = height/2;
- segment = width/num;
- margin = segment/3;
- space = (segment-2*margin)/vLines;
- for (int i=0; i < num; i++) {
- myThing[i] = new Thingie(i*segment, 75);
- }
- }
- void draw() {
- background(0);
- for (int i=0; i < num; i++) {
- myThing[i].run();
- }
- }
- class Thingie {
- float y_up, y_down, x;
- float incr, theta;
- float maxSize, sw, a, a2;
- Thingie(float _x, float _maxSize) {
- x = _x+margin;
- maxSize = 50+ _maxSize;
- }
- void run() {
- move();
- display();
- }
- void move() {
- incr = map(sin(theta), -1, 1, 10, maxSize);
- sw=2;
- a = map(sin(theta), -1, 1, PI, PI*1.5);
- a2 = map(sin(theta), -1, 1, 0, PI*.5);
- y_up = oy - incr;
- y_down = oy + incr;
- theta +=0.052358;
- }
- void display() {
- strokeWeight(sw);
- for (int i=0; i<= vLines; i++) {
- line(x+space*i, oy-incr, x+space*i, oy+incr); //vLine going up
- noFill();
- arc((x+space*i)+50, oy-incr-1, 100, 100, PI, a);
- arc((x+space*i)-50, oy+incr+1, 100, 100, 0, a2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement