Implementing restart animation function