Help with moving vertical lines

another sin version

Linea[] lineas = new Linea[120];

int posX;
int limiteUp;
int limiteDown;

int separacionLineas;
int i;
int cantidadLineas = 108;
float inclinacion =1;


void setup() {
  size (1080, 720);

  posX = 10;
  limiteUp = height*50/100;
  limiteDown = height;
  separacionLineas = 1;

  for ( int i =0; i<cantidadLineas; i++) {
    lineas[i] = new Linea(posX*i*separacionLineas, limiteUp, limiteDown-i*inclinacion, map(i, 0, cantidadLineas, 0, TWO_PI));
  }

  //var1 =0;
}

void draw() {
  background(0);
  stroke(255);
  strokeWeight(3);

  for (i=1; i<cantidadLineas; i++) {
    lineas[i].display();
    lineas[i].move();
  }
}

//=============================================================================================
//LINEAS OBJECT

class Linea {
  float posXa;
  float posYa;
  float posYb;

  float angle;

  float speed = 0.01;

  Linea(float var3, float var1, 
    float var2, 
    float angle_) {
    posXa = var3;
    posYa = var1;

    posYb = var2;

    angle=angle_;
  }

  void display() {
    //stroke(255);
    //strokeWeight(3);
    line (posXa, posYa, 
      posXa, height/2);
  }

  void move() {
    posYa = sin(angle)*200+height/2; 
    posYb = posYa+200;

    angle +=speed;
  }//func
  //
}
//
2 Likes