to make things move up and down, or left and right, or to make objects pulse etc. its always a good idea to use a sin function.
so you can say b = sin(frameCount)
using frameCount is just the same as declaring a variable and counting it up every frame. this would result in b changing from -1, to 1. but as we need it to be bigger, we multiply it with 60. To adjust the speed you can divide frameCount by X, in this case 10. and to move the whole head down, i added 100 to it.
btw, you can easily change the position of your shape by using translate(a,b). its easier than adding a and b to every vertex.
Code:float a = 0;
float b = 0;
void setup()
{
size(500, 500);
background(255);
smooth();
fill(100);
stroke(0);
}
void draw(){
a = a+2;
b = 100+sin(frameCount/10.0)*60;
if (a>700){a=0;}
background(255);
fill(200);
translate(a,b);
beginShape();
curveVertex(-200, 500); // the first control point
curveVertex(-210,500);
curveVertex(-140,300);
curveVertex(-70,230);
curveVertex(-10,220);
curveVertex(40,225);
curveVertex(70,240);
curveVertex(80,290);
curveVertex(40,290);
curveVertex(10,280);
curveVertex(-10,270);
curveVertex(-40,320);
curveVertex(-50,380);
curveVertex(-20,500);
curveVertex(-50, 240); // is also the last control point
endShape();
fill(255);
ellipse(50,260,8,18);
ellipse(70,260,8,18);
endShape();
}