Bhagavad Gita, Chapter 2, Verse 14
Notions of heat and cold, of pain and pleasure, are born, O son of Kunti, only of the contact of the senses with their objects. They have a beginning and an end. They are impermanent in their nature. Bear them patiently, O descendant of Bharata.
Pleasure and pain come and go. Learn to sit with both.
Pleasure and pain arrive the same way weather does - through contact, temporary, out of your control. The move isn't to chase one and dodge the other, it's to sit through both.