import peasy.*;
PeasyCam camera;
ArrayList<PVector> meshPos = new ArrayList();
float xStep = 20;
float yStep = 20;
int meshNUM = 20;
PShape meshStrip;
FloatList movingV = new FloatList();
void setup() {
size(800, 500, P3D);
camera = new PeasyCam(this, 400);
meshStrip = createShape();
for (int i=0; i<meshNUM; i++) {
meshPos.add(new PVector( i * xStep, 0, 0) );
}
meshStrip.beginShape(TRIANGLE_STRIP);
meshStrip.stroke(0, 40);
for (int i=0; i<meshPos.size(); i++) {
meshStrip.vertex(meshPos.get(i).x, meshPos.get(i).y, meshPos.get(i).z);
meshStrip.vertex(meshPos.get(i).x, meshPos.get(i).y + yStep, meshPos.get(i).z);
}
meshStrip.endShape(CLOSE);
}
void draw() {
background(120);
for (int i=0; i<meshStrip.getVertexCount(); i+=1) {
movingV.set(i, sin(radians(i * 360.0/meshStrip.getVertexCount() + frameCount * 2)) * 30);
PVector _v = new PVector(meshStrip.getVertex(i).x, meshStrip.getVertex(i).y, movingV.get(i));
meshStrip.setVertex(i, _v);
}
translate(-xStep * meshNUM * 0.5, 0);
shape(meshStrip, 0, 0);
}