Coatings containing at least one layer having a composition gradient through its thickness