The deformation equation of a spacelike submanifold with an arbitrary codimension is given by a general construction without using local frames. In the case of codimension-1, this equation reduces to the evolution equation of the extrinsic curvature of a spacelike hypersurface. In the more interesting case of codimension-2, after selecting a local null frame, this deformation equation reduces to the well known (cross) focusing equations. We show how the thermodynamics of trapping horizons is related to these deformation equations in two different formalisms: with and without introducing quasilocal energy. In the formalism with the quasilocal energy, the Hawking mass in four dimension is generalized to higher dimension, and it is found that the deformation of this energy inside a marginal surface can be also decomposed into the contributions from matter fields and gravitational radiation as in the four dimension. In the formalism without the quasilocal energy, we generalize the definition of slowly evolving future outer trapping horizons proposed by Booth to past trapping horizons. The dynamics of the trapping horizons in FLRW universe is given as an example. Especially, the slowly evolving past trapping horizon in the FLRW universe has close relation to the scenario of slow-roll inflation. Up to the second order of the slowly evolving parameter in this generalization, the temperature (surface gravity) associated with the slowly evolving trapping horizon in the FLRW universe is essentially the same as the one defined by using the quasilocal energy.