Reputation: 4022
I am essentially drawing a texture onto itself every frame, each time i draw it i want to decrement the alpha so that it eventually hits 0 so no artifacts are left.
The basic equation is:
result = (source * sourceBlendFactor) blendFunction (destination * destinationBlendFactor)
And since my destination is Color.Transparent I figure i need:
result = 0 = (source * sourceBlendFactor);
Im racking my brain going over the different BlendState components but I cant seem to acheive this...
Is there any way to have the alpha decrement linearly?
Upvotes: 0
Views: 372
Reputation: 15130
Sure you can. Define a value that holds the current alpha state between 1 and 0. Decrement that value each frame untill it hits 0. In the draw method, you determine the alpha value of the tint color.
byte alpha = 255 - (currentAlphaState * 255);
spriteBatch.Draw(...., new Color( 255, 255, 255, alpha) ...); // assuming white is your default tint color
Upvotes: 1