70s or 80s animation where guy beats evil demon with science
It's an animated movie that was on Showtime or Cinemax a few years ago. The main character or characters were sucked into a fantasy world or something and are going on an adventure/trying to get out. Towards the end after the hero has lost his friends he is fighting the demon/warlock/bad guy alone in some mountainous desert. The demon claims he's all powerful because of his magic but the hero shoots down all of his claims with science. I specifically remember when the bad guy says, "I'm so powerful I could pluck the sun out of the sky" to which the hero replies that he'd always miss the sun by 8 minutes, because that's how long it takes its light to reach the earth. Eventually the demon/warlock/bad guy is defeated by the hero's logics and he saves the fantasy world/goes back to earth.