It's impossible to ignore gravity though, and the movement will inevitably cause heat, causing it to lose heat and therefore eventually run out of energy.

Perpetual motion is impossible.