We study the geometry and dynamics of both isolated and dynamical trapping
horizons by considering the allowed variations of their foliating two-surfaces.
This provides a common framework that may be used to consider both their
possible evolutions and their deformations as well as derive the well-known
flux laws. Using this framework, we unify much of what is already known about
these objects as well as derive some new results. In particular we characterize
and study the "almost-isolated" trapping horizons known as slowly evolving
horizons. It is for these horizons that a dynamical first law holds and this is
analogous and closely related to the Hawking-Hartle formula for event horizons.Comment: 39 pages, 6 figures, version to appear in PRD : a few minor changes
and many typos corrected in equation