While loop running without animation