~ていく and ~てくる (usually written in kana, since they are such common suffixes) can express both physical movement (such as in 行【い】
ってくる "go and come back") or a continued change in state. Since your question regards the latter usage, I'll restrict my answer to that.
To use your examples:
雨【あめ】がやんできた。 The rain [over a period of time up until now] stopped.
雨【あめ】がやんでいった。 The rain [over a period of time up until some time before now] stopped.
With the past tense, the point in time at which the action ends, relative to the present moment, changes depending on whether きた or いった is used.
空【そら】が明【あか】るくなってくる。 The sky [over a period of time through now and continuing to some future point] brightens.
空【そら】が明【あか】るくなっていく。 The sky [over a period of time starting now and continuing indefinitely] brightens.
With the present tense, the factor that changes is the point in time at which the action begins. (~てくる typically implies the action started in the past, while ~ていく typically implies the action starts now.)
Any verb that indicates a change in state is a prime candidate for the ~ていく and ~てくる suffixes. なる, 増【ふ】える, 減【へ】る, and 広【ひろ】がる are a few examples.
As a postscript, I should also mention that the choice between these two can depend also on whether "now" means actual now versus a reference point in the past or future. The diagram on page 120 of this text may help clear this up.