The excitation and damping of transversal coronal loop oscillations is studied using one-and two-dimensional models of line-tied cylindrical loops. By solving the time-dependent magnetohydrodynamic equations it is shown how an initial disturbance generated in the solar corona induces kink mode oscillations. We investigate the effect of the disturbance on a loop with a non-uniform boundary layer. In particular, a strong damping of transversal oscillations due to resonant absorption is found, such as predicted by previous works based on normal mode analysis.