title: curveVertex in Processing
body: <p><a href="https://i.stack.imgur.com/VQQB4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VQQB4.png" alt="dunes" /></a>So, I'm creating a curveVertex that it's animated. It's a line, basically, with amplitude. The image is a rough sketch of what I want to achieve
  Now I want to fill it, creating the idea of a dune or mountain, but when I do it, an imaginary line is created between the first and last point and does not fill it the right way</p>
  <pre><code>int count = 50;
  float time;
  float amp;
  
  // line param
  float spacing = 45;
  
  class dunes {
  
    void drawDunes() {
  
      stroke(211, 132, 52);
      strokeWeight(2);
      noFill();
  
      frameRate(24);
      //translate(-width, -height);
      //scale(3);
  
      time += .03;
      amp = map(width, 0, width, 5, 15);
  
      pushMatrix();
      translate(width/2 - count*spacing/2, 0);
  
      beginShape();
      curveVertex(0, height/2);
      for (int i = 0; i &lt; count; i++) {
        float x = i * spacing;
        float y = height-250 + (sin(x + time) * amp + random(-.4, .4));
  
        curveVertex(x, y);
      }
      curveVertex(count*spacing, height/2);
      endShape();
      popMatrix();
    }
  }
  </code></pre>
  <p>How do I fill a curveVertex that it's like a sinusoidal wave?</p>