Did you know corals are actually animals not plants? Corals are related to Jellyfish and Anemone's.
Many build hard skeletons and live as a colony where lots of individual polyps (think of a jellyfish upside down in a cup with their tentacles sticking out) live side by side. They react differently to night time darkness and daylight. Check out this Flowerpot Coral (Goniopora sp.) in one of our testing tanks.
Filmed on a time lapse camera over a couple of days, when the light is on the polyps expand and wave around in the current feeding and then at night time the colony retracts for protection.