how supergiant stars repeatedly cool and heat up