Game animation on JavaScript