How to soften or fade the edges of a material that uses mesh distance fields?

I made a water shader that creates foam on the coastline using mesh distance fields but it looks un-natural because there is no transition, it’s a sharp line, how would I go about making it fade or soften around the edges?

Try the depth fade node and plug it into the opacity.