Your rat is trying to adjust its vision by adding motion to it. This "weaving" is especially common in red or pink eyed rats, who seem to have even worse vision that their dark-eyed companions. Here's a good article on rat vision in case you want to explore it further:
Rattus Biologicus: Rat Vision - Do They See What We See