Flickering on Background/Textual Fade
Hey,
As part of a game I am creating an intro screen. The intro screen currently employs a fade effect through the use of a loop in which I iterate through the (three sets of) 255 colour combinations (R,G,B).
It works very well apart from that fact that the text appears to flicker badly as the fade in/out occurs. Is there anything that can be done to stop this?
A snippet of my code is as follows:
Code:
Public Function fade(fadetype As Boolean)
fColor = 0
tColor = 0
If fadetype = False Then
tColor = 0
For fColor = 255 To 0 Step -1
introscreen.BackColor = RGB(fColor, fColor, fColor)
Sleep 15
Next
End If
If fadetype = True Then
tColor = 255
For fColor = 0 To 255 Step 1
introscreen.BackColor = RGB(fColor, fColor, fColor)
If tColor > 0 Then
tColor = tColor - 1
optext.ForeColor = RGB(tColor, tColor, tColor)
End If
Sleep 15
Next
End If
maintm.Enabled = True
End Function
Thanks and hope you are all well. :)
Re: Flickering on Background/Textual Fade
Try calling the .Cls() method :duck:
Also, you should concider changing your multiple "If-End If" statements to a "If-Else If-End If" statement:
Code:
If ... Then
'...
ElseIf ... Then
'...
End If
... because your application is loosing precious time doing it your way. Also, your "Function" does not return anything, so it could be a Sub as well :)