Sunset image fade out during sunset.

Hello all,

I have on screen a sun image that my aim is to have gradually fade out as the day progresses until fully faded and replaced by a moon image after sunset.

Is there formula to make this possible?

I tried but did not work.

$if(df("hh:mma", ai(sunset)),  $ FADE_INVERTED$

Test this formula, this are going to change the alpha of the color 100 minutes before the sunset, to make it invisible at sunset.

$ce(#FF0000, alpha, if((df(S, ai(sunset))-df(S))/60>100,100, (df(S, ai(sunset))-df(S))/60<100&ai(isday)=1,mu(round, (df(S, ai(sunset))-df(S))/60),0))$

Great thank you so much. Will have to check tonight at sunset to see if it has dissapearred.

The sun image sits off to the side of a globe image is there a way to also get this to rotate around the globe image to it's relevant time as per a clock face?