Yes. You are thinking of the pathetic fallacy. The term was coined by John Ruskin, and it is closely related to the device of personification. Often, when using the pathetic fallacy, authors will attribute human characteristics to setting, usually reflecting a character's emotions and personality. Ruskin originally intended the definition to describe a mistake or a lapse in language control, but it has since been adopted to mean a conscious choice in style.
The following example is from Alfred, Lord Tennyson's poem "Maud":
There has fallen a splendid tear
From the passion-flower at the gate.
She is coming, my dove, my dear;
She is coming, my life, my fate.
The red rose cries, "She is near, she is near;"
And the white rose weeps, "She is late;"
The larkspur listens, "I hear, I hear;"
And the lily whispers, "I wait."
Here, we can see the emotions of the speaker are reflected in the flowers. Other literary works that make extensive use of pathetic fallacy include Macbeth and Jane Eyre. Here is an example from Jane Eyre:
“It stood up, black and riven: the trunk, split down the center, gasped ghastly. The cloven halves were not broken from each other, for the firm base and strong roots kept them unsundered below; though community of vitality was destroyed—the sap could flow no more: their great boughs on each side were dead, and next winter’s tempests would be sure to fell one or both to earth; as yet, however they might be said to form one tree—a ruin, but an entire ruin.”
Here, the tree reflects Jane & Rochester's relationship: strong roots and base, but a brutal strike has split the two. The "sap" of their passion could no longer flow, & another blow would surely end the relationship. In this novel, that blow comes in the form of Bertha, Rochester's legal wife. Thus pathetic fallacy can be used in obvious or subtle ways, and can be an effective literary device.