How does a temperature affect the amount of energy in a substance​?