I made it so that it smoothly goes offscreen no matter the size or direction. Check the code for more details.