Javascript animation using sprites