I am new to XNA. I am trying to make a basic fade out for some splash screens, credits screen etc. My thought was to bring the opacity value down in increments equal to 1 millisecond. So figuring that XNA tries to keep the fps around 60, I decrement the increment value by the elapsed game time in Millis. The animation is stopping with an opacity of 0.36...... Is the difference the amount of time the draw() method takes? Plus the time this method takes? What am I missing? Thanks in advance!
public string FadeOut(GameTime gameTime, float fadeTimeSeconds)
{
float totalTime = fadeTimeSeconds * 1000;
dTime += gameTime.ElapsedGameTime.Milliseconds;
tTime += dTime;
this.Increment = this.Opacity / totalTime;
if (tTime <= totalTime)
{
this.Opacity -= (this.Increment * dTime);
dTime = 0;
}
return this.Opacity.ToString();
}//end of FadeOut()






