Fade in/out

Blitz3D Forums/Blitz3D Programming/Fade in/out

Hello folks..does anyone know how to do fade in fade out of images, sprites, whatever...I have to do that with 2 logos on begin of my aplication...so, i belive someone is already face this problem in Blitz3d, so, I will apprechiate a lot if someone can post me useful, functional code for this problem, not some ideas how to do things...I hope i'm not asking too much..thanks anyway..

Hi,

look at: BrushAlpha brush,alpha#

A few ways of doing it...

Play with the Gamma to fade the whole screen (full screen only)

Stick black a quad (or sprite) infront of the camera and entityalpha it from 0 to 1 to fade to black.

Fade out all the DX lights (including ambient light) to 0,0,0 (obviously this won't work with full bright stuff)

That's probably about it.

http://www.blitzbasic.com/Community/posts.php?topic=39696

Use the 3d sprites infront of the camera:its the best way other than for fading the whole screen

Hi, I have something usefull for you probably: You just have to call InitFade(), then either FadeIn() or FadeOut() and then before every RenderWorld Command RenderFade()

You can also check if a fade is done or not if you check the value of FadeScreen\Alpha.

Hope that helps:

Type FadeScreen
	Field sprite
	Field alpha#
	Field status
	Field speed#
End Type
Global FadeScreen.FadeScreen = New FadeScreen

Function InitFade()
	FadeScreen\Sprite = CreateSprite() 
	EntityColor  FadeScreen\Sprite,0,0,0
	MoveEntity	 FadeScreen\Sprite,0,0,0 ; move to just before camera
	EntityOrder	 FadeScreen\Sprite,-100  ; make sure it gets drawn last
	HideEntity FadeScreen\Sprite
End Function

Function FadeIn()
	FadeScreen\alpha=1
	FadeScreen\status=1
	FadeScreen\speed#=0.05
End Function

Function FadeOut()
	FadeScreen\alpha=0
	FadeScreen\status=2
	FadeScreen\speed#=0.05
End Function

Function RenderFade()
	EntityAlpha FadeScreen\Sprite,FadeScreen\Alpha#
	ShowEntity FadeScreen\Sprite
	If FadeScreen\Status=2
		FadeScreen\Alpha#=FadeScreen\Alpha#+FadeScreen\Speed#
		If FadeScreen\Alpha#>1 Then FadeScreen\Status=3
	End If
	If FadeScreen\Status=1
		FadeScreen\Alpha#=FadeScreen\Alpha#-FadeScreen\Speed#
		If FadeScreen\Alpha#<0 Then FadeScreen\Status=0
	End If
End Function

Function DestroyFade()
	FreeEntity FadeScreen\Sprite
End Function