Javascript animation assignment