why does the temperature of an object rise when it is heated?