Ask a questionAsk a question
 

AnswerFade Animation

Answers

  • Monday, November 10, 2008 8:52 AMwebtubbs Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Loop, and lower the Opacity of your form until it is invisible....

    Do Until Me.Opacity = 0 
        Me.Opacity -0.005  
        Application.DoEvents()  
    Loop  
    Me.Close() 

    Regards,

    Wayne Taylor
    • Marked As Answer byVB Addictive Friday, November 14, 2008 7:17 AM
    •  

All Replies

  • Monday, November 10, 2008 8:52 AMwebtubbs Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Loop, and lower the Opacity of your form until it is invisible....

    Do Until Me.Opacity = 0 
        Me.Opacity -0.005  
        Application.DoEvents()  
    Loop  
    Me.Close() 

    Regards,

    Wayne Taylor
    • Marked As Answer byVB Addictive Friday, November 14, 2008 7:17 AM
    •  
  • Monday, November 10, 2008 10:00 AMpotta vijay kumar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi,

    You can fade a form by changing the opacity using loop.

    another method is using javascript and fade, check this sample code.

    <script language="JavaScript"><!-- 
    function fader(object,text) { 
        setTimeout("fade('" + object + "','" + text + "','#000000')",100); 
        setTimeout("fade('" + object + "','" + text + "','#333333')",200); 
        setTimeout("fade('" + object + "','" + text + "','#666666')",300); 
        setTimeout("fade('" + object + "','" + text + "','#999999')",400); 
        setTimeout("fade('" + object + "','" + text + "','#cccccc')",500); 
        setTimeout("fade('" + object + "','" + text + "','#ffffff')",600); 
     
    function fade(object,text,color) { 
        if (document.layers) { 
            document.layers[object].document.open(); 
            document.layers[object].document.write('<font color="' + color + '">' + text + '<\/font>'); 
            document.layers[object].document.close(); 
        } 
        else if (document.all) { 
            document.all[object].style.color = color; 
        } 
    //--></script
     
    <form> 
    <input type="button" value="Click me" onClick="fader('myLayer1','This is some text')"
    </form> 
     
    <div id="myLayer1" style="position:absolute"
    This is some text 
    </div> 
     


    vijay
  • Wednesday, November 04, 2009 6:32 AMchickie Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    too fast too fast...how do i make it slower ? thanks
    Smile, Joshua Siew
  • Wednesday, November 04, 2009 6:45 AMjwavila Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This is an old thread

    Please post a new thread :)
  • Wednesday, November 04, 2009 6:50 AMAcamar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Make the decrement smaller


    Do Until Me.Opacity = 0 
        Me.Opacity -0.0005  
        Application.DoEvents()  
    Loop  
    Me.Close() 
  • Wednesday, November 04, 2009 6:52 AMbdbodger Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Use a timer but if you fade it too much you won't be able to click on any of the controls .

        Private Sub Form1_Load( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
            Timer1.Interval = 100 
            Timer1.Enabled = True
        End Sub
    
        Private Sub Timer1_Tick( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Timer1.Tick
            If Me.Opacity < 0.5 Then
                Timer1.Enabled = False
            End If
            Me.Opacity -= 0.01
        End Sub
    
    

    coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
    Please format the code in your posts with the button . Makes it easier to read .