  Both simulations and observations have confirmed that the spin of
haloes/galaxies is correlated with the large scale structure (LSS) with a mass
dependence such that the spin of low-mass haloes/galaxies tend to be parallel
with the LSS, while that of massive haloes/galaxies tend to be perpendicular
with the LSS. It is still unclear how this mass dependence is built up over
time. We use N-body simulations to trace the evolution of the halo spin-LSS
correlation and find that at early times the spin of all halo progenitors is
parallel with the LSS. As time goes on, mass collapsing around massive halo is
more isotropic, especially the recent mass accretion along the slowest
collapsing direction is significant and it brings the halo spin to be
perpendicular with the LSS. Adopting the $fractional$ $anisotropy$ (FA)
parameter to describe the degree of anisotropy of the large-scale environment,
we find that the spin-LSS correlation is a strong function of the environment
such that a higher FA (more anisotropic environment) leads to an aligned
signal, and a lower anisotropy leads to a misaligned signal. In general, our
results show that the spin-LSS correlation is a combined consequence of mass
flow and halo growth within the cosmic web. Our predicted environmental
dependence between spin and large-scale structure can be further tested using
galaxy surveys.
