Pupil are the black circle in eyes working as camera aperture, which let light get into eyes. It can change size just like the aperture. When you are in a bright environment, the pupil shrinks to let less light in, so that you won't feel blinding. When you are in a dark place, the pupil dilate to let more light in so that you could see clearer. Other than light, pupil changes size in response to emotions too. According to researches, pupil dilates when people are angry, terrified or excited, because the muscle of irises is controlled by nervous system. It is the involuntary response to different stimulation to nervous system. This is why panic attack causes pupils dilate.