The change in form s form an igneous to a sedimentary rock is due to the weathering and erosion and which is further compacted and solidified under the lithification to form a sedimentary rock which again under the pressure and heat changes to metamorphic rock.
And then the cycle repeats itself as the rocks undergo metamorphism that is contact and thermal in nature. And all this starts with the cooldown of the magma or the lava fourth earth's crust.