We study the propagation of light in a nonstatic linear gravitational potential associated with nonlinear density fluctuations. A potential approximation to Einstein's field equations allows us to derive simple expressions for the anisotropies induced in the temperature of the microwave background radiation, associated in particular with angular distortions induced by the time-varying gravitational potential along the line of sight to the surface of last scattering. We apply our results to two examples of interest: a compensated void in the thin-shell approximation and a compensated lump in the Swiss cheese approach, obtaining the same results, with regard to temperature profiles, as those given previously in the literature using a general relativistic treatment.