The rock cycle shows how the three main types of rocks - igneous, sedimentary, and metamorphic - are interrelated and constantly changing into one another through geological processes. Igneous rocks form from cooling magma, sedimentary rocks form through the compaction and cementation of sediments, and metamorphic rocks form from existing rocks undergoing changes due to heat and pressure in Earth's crust. Rocks can be transformed into any other type of rock depending on the conditions they experience.