A simple set of routines to FadeIn an image and then FadeBack to the original screen:
'draw a pretty screen
'now, create an image to fade in and out. to keep it simple, I'm going to work with just a circle so I don't need external files
FadeIn 212, 60, image
FadeBack
Background
= _CopyImage(0) 'the background before we alter it with a fade in effect. For i
= 1 To 10 'ten steps, 1 per second for slowly visible fade in effect
For i
= 1 To 10 'ten steps, 1 per second for slowly visible fade in effect
Now I'm not going for any smooth fade in and fade out effects here; I'm just shooting for something simple to showcase the _SETALPHA command. All this does is take 10 seconds to slowly fade in a yellow circle onto the center of the screen, and then fadeout that circle over another 10 seconds. It's one step of fading every second, so it's not a smooth transition here, but is instead one where you can visually watch each step along the way. If I was going make this a smooth fade in and fade out, I'd probably do it with a much smoother FOR loop with a higher FPS limit, like so:
'draw a pretty screen
'now, create an image to fade in and out. to keep it simple, I'm going to work with just a circle so I don't need external files
FadeIn 212, 60, image
FadeBack
Background
= _CopyImage(0) 'the background before we alter it with a fade in effect.
Just be careful to free all your images so you don't get a memory leak anywhere in your program. I really didn't shoot too hard to do this here (Background never frees itself anywhere, so multiple calls would generate an memory leak), but it's not an issue for a demo this simple. Just don't let it catch you in your own code anywhere, if you're doing anything more than just fading in and out of a simple splash screen, for instance. ;)
@bplus You posted while I was in the middle of making and editing my post. Looks like what you have is very similar to this, but PBBTTTTTBBBTTT!! I'm going to share this anyway, since I've already typed it all up and such. :P