Quite simple... Just add an equation before projecting the vertex position.
OUT.Position = IN.Position + ScaleFactor*0.5*(sin(IN.Position.y*Frequency*Time)+1) * IN.Normal.xyz;
The effect result is so so, but it's really interesting.
Another two animation effects in Cg Tutorial requires host application support, so I don't wanna study it now.
Refer to Cg Tutorial Chapter 7
Get Source Code Here.