Tentative fix for transitioning animations, nobody understands this code, it's sad.