Results 1 to 2 of 2

Thread: Flickering on Background/Textual Fade

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    Exclamation 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.

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Flickering on Background/Textual Fade

    Try calling the .Cls() method

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width