Gamma-ray burst (GRB) light curves generally are energy dependent, i.e., the higher the photon energy, the narrower the pulse. In addition, the peak of the pulse at lower energies is usually delayed compared with that in higher energy. The phenomenon even exists in some X-ray flares and following optical flares. However, its origin is still unclear. Here we calculate the emission in different bands produced from different-thickness shocked shell due to radiative cooling, with the equal arrival time volume effect considered. We find the emission profile is energy dependent and that the light curves show spectral lag, which are consistent with the observations. This can be an explanation of the energy dependence of light curve and spectral lag in GRB, X-ray flare and following optical flare.