js animation else statement