• Welcome to Valhalla Legends Archive.
 

Fade from white to picture

Started by Spht, December 28, 2005, 01:47 PM

Previous topic - Next topic

Spht

I'm looking for an efficient way of doing an animated fade transition from total white to a picture.  The picture is always only 473x175.  There is also text .Print'ed on the area which needs to stay during the transition.

For example:



10 frames per second should suffice.

Ringo

#1
AlphaBlend() should be perfect for that if you raise the opacity on a timer or somthing.

[EDIT]:
Hmm give this ago:
Haveing 2 pictures to fade into each other:

Public Type ALPHAFADE
    BlendOp As Byte
    BlendFlags As Byte
    SourceConstantAlpha As Byte
    AlphaFormat As Byte
End Type
Private Declare Function AlphaBlend Lib "msimg32.dll" (ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal BLENDFUNCT As Long) As Long

Private Sub SetOpacity(intOpacity As Integer)
    Dim AB As ALPHAFADE
    Dim BlendValue As Long
    With AB
        .BlendOp = 0
        .BlendFlags = 0
        .SourceConstantAlpha = intOpacity
        .AlphaFormat = 0
    End With
    'copy the type to a Long
    CopyMemory BlendValue, BF, 4
    'AlphaBlend the picture from Picture1 over the picture of Picture2
    AlphaBlend Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, BlendValue
End Sub

Spht

#2
AlphaBlend works nicely and I just re-draw the text each update.  Thanks.