code: function swing( dt ) {
    pen.x += (pen.z * Math.sin( pen.y ) * dt);
    pen.y += (pen.x * dt);
    return new Vector( Math.sin(pen.y), Math.cos(pen.y) );
  }
docs: A simple pendulum implementation from Rosettacode.org http://rosettacode.org/wiki/Animate_a_pendulum