Thus the edges of continents tend to get accumulations of sand, while areas offshore tend to get accumulations of mud. All through this process, animals that build their skeletons of calcium carbonate die and add their shells to the sediment, but only very far from the source areas of the sand and clay can deposits made up just of animal skeletons form. Such deposits made mostly from calcium carbonate form limestones. Sedimentary rocks tend to form a gradient of grain size and composition. If you take existing rocks, bury them, and expose them to heat an pressure, they get cooked into other rocks.
Chemical reactions take place, and mineral grains grow.
The basic proccess involved in the formation of metamorphic rocks is that in rocks exposed to heat and pressure, but not enough heat enough to melt, mineral grains start to grow. Start, for example, with a clay. Heat and pressure turn it into a shale. Under more heat and pressure, the mineral grains grow large enough to be visible to the eye, into a medium grained schist, or a coarse grained gneiss. More heat and pressure melt the rock into a liquid magma.