The code first works out the star's mass from an imputed radius and temperature. The mass can then be used to work out the remaining time for the star. The slider gets a number between 1 and 0 which is multiplied to the lifetime where the radius, temperature and luminosity is worked out and displayed. To work out the colour of the star the temperature is used against some values. This colour is overlays the texture image of the star.