We examine the origin of clustercentric gradients in the star formation rates and colors of rich cluster galaxies within the context of a simple model where clusters are built through the ongoing accretion of field galaxies. The model assumes that after galaxies enter the cluster their star formation rates decline on a timescale of a few Gyrs, the typical gas consumption timescale of disk galaxies in the field. Such behaviour might be expected if tides and ram pressure strip off the gaseous envelopes that normally fuel star formation in spirals over a Hubble time. Combining these timescales with mass accretion histories derived from N-body simulations of cluster formation in a Lambda-CDM universe, we reproduce the systematic differences observed in the color distribution of cluster and field galaxies, as well as the strong suppression of star formation in cluster galaxies and its dependence on clustercentric radius. The simulations also indicate that a significant fraction of galaxies beyond the virial radius of the cluster may have been within the main body of the cluster in the past, a result that explains naturally why star formation in the outskirts of clusters (and as far out as two virial radii) is systematically suppressed relative to the field. The agreement with the data beyond the cluster virial radius is also improved if we assume that stripping happens within lower mass systems, before the galaxy is accreted into the main body of the cluster. We conclude that the star formation rates of cluster galaxies depend primarily on the time elapsed since their accretion onto massive virialized systems, and that the cessation of star formation may have taken place gradually over a few Gyrs.