The literary term is:
The phrase pathetic fallacy is a literary term for the attributing of
human emotion and conduct to all aspects within nature. It is a kind
of personification that is found in poetic writing when, for example,
clouds seem sullen, when leaves dance, or when rocks seem indifferent.
The British cultural critic John Ruskin coined the term in his book,
Modern Painters (1843–60).
Pathetic fallacy (Wikipedia)
Pathetic fallacy, poetic practice of attributing human emotion or
responses to nature, inanimate objects, or animals. The practice is a
form of personification that is as old as poetry, in which it has
always been common to find smiling or dancing flowers, angry or cruel
winds, brooding mountains, moping owls, or happy larks.
n. The attribution of human emotions or characteristics to inanimate
objects or to nature; for example, angry clouds; a cruel wind.
American Heritage Dictionary
It's also metaphor and personification, as have been mentioned already.