In literature, this is called “pathetic fallacy.”
Other related questions:
What is it called when nature reflects emotions?
There is no single answer to this question as different people may interpret it in different ways. Some might say that it is called “emotional resonance,” while others might simply say that it is called “reflecting emotions.”
What is the literary term for mood?
The literary term for mood is the atmosphere of a piece of writing.
What is called pathetic fallacy?
Pathetic fallacy is the attribution of human emotions or characteristics to inanimate objects or natural phenomena.
What is the difference between pathetic fallacy and anthropomorphism?
Pathetic fallacy is when someone attributes human emotions or characteristics to inanimate objects, whereas anthropomorphism is when someone attributes human characteristics to animals or other non-human entities.