Animate a Logo

  • Thread starter Thread starter Kagsy
  • Start date Start date
K

Kagsy

Dear Group,

I am trying to animate an image (move in from the left of
the form) which is our company logo. It is OK if I start
the left of the image at 0 and move it but you cannot
exceed the dimensions of the form as you can with right
hand side of the form, ie the form could be 10 cms (wide)
and the image could be set to the left 12 cms.

Is there any work around that the group can think that
would let me move an image from the left of the screen
with its right side at 0 and slowly move in from the left
to a preset point? I don't want to stretch the image as
this will distort it.

I am using Access 97 but I don't think that would make a
difference. I am not looking for the code, more the
technique.

Thanks

Kagsy
 
I assume you want the logo to fly in from off screen to the left. Correct?

Why not size the logo to 0 and gradually widen the image to 100%, say by 10%
each time. Once it is full-size, then move the logo to the center.
Something like this:
'**************************
Private Sub Form_Load()
Dim OriginalWidth As Integer

OriginalWidth = Me.OLELogo.Width
Me.OLELogo.Width = 0
Me.OLELogo.Visible = True
Dim i As Integer
Dim j As Long
For i = 1 To 10
For j = 1 To 100
DoEvents
Next j
Me.OLELogo.Width = OriginalWidth / 10 * i
Next i

For i = 1 To 20
For j = 1 To 100
DoEvents
Next j
Me.OLELogo.Left = OriginalWidth / 10 * i
Next i

End Sub
'**************************
This assumes the image control is named OLELogo.
 
I just realized that it won't work in the OnLoad or OnOpen events. You have
to call it from the OnTimer event. The first thing you do in the OnTimer
event is set the TimerInterval to 0 so it won't fire again. This has the
effect of triggering the code once.

On my website (see sig below) is a small sample database called
"Animation.mdb" to which I have added this animation.
 
Back
Top