The literary device would be personification. This is because personification is when an author gives inanimate objects human qualities or actions.
Example:
The blades of grass danced through the meadow to the wind's hypnotizing beat.
In this sentence, the blades of grass dancing illustrate how grass sways when disturbed by wind. Because grass cannot dance this is a personification.