Yesterday morning I got up and looked out of the window.
The sun was shining but the ground was very wet.
It had been raining.
It was not raining when I looked out of the window; the sun was shining.
But it had been raining before.That's why the ground was wet.
Had been ~ing is the past perfect continuous:
I/we/you/they had(= I'd etc.)been doing/working/playing etc.
he/she/it had (= he'd etc.)been doing/working/playing etc.
Examples:
1.When the boys came into the house, their clothes were dirty, their hair was
untidy and one of them had a black eye.They'd been fighting.
2.I was very tired when I arrived home.I'd been working hard all day.
B.You can say that something had been happening for a period of time before
something else happened:
Example:
1.Our game of tennis was interrupted.We'd been playing for about half an hour
when it started to rain very heavily.
2.Ken gave up smoking two years ago.He'd been smoking for 30 years.
C.Had been ~ing (past Perfect continuous) is the past of have been ~ing
(present perfect continuous).Compare:
Present perfect continuous
Example:
1.I hope the bus comes soon. I've been waiting for 20 minutes.(before now)
2.He's out of breath.He has been running.
Past perfect continuous
Example:
1.At last the bus came. I'd been waiting for 20 minutes.(before the bus came)
2.He was out of breath. He had been running.
D.Compare had been doing and was doing (past continuous):
Example:
1.It wasn't raining when we went out.The sun was shining. But it had been
raining, so the ground was wet.
2.Ann was sitting in an armchair watching television.She was tired because she'd
been working very hard.
E.Some verbs (for example, know and want) are not normally used in the continuous:
Example:
1.We were good friends.We had known each other for years.
(not 'had been knowing')