View Full Version : Anitmation code?


Acidburn
02-01-2004, 03:19 AM
this is not my code, But could someone tell me if this is ok? it runs but it also does other things aswell just wondering if there is something else i can take out to shorten the code?

I'm hoping to include this in my coursework for IT however in order to do so im must understand the code some more so if someone could also explain it? However all the credit will go to the aurthor!
Credit goes to: http://www.candace-tripp.com/_pages/access_downloads.asp


Option Compare Database
Option Explicit

Global bOpened As Boolean

Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type

' x, y, nWidth, nHeight in pixels
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, _
ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal bRepaint As Long) As Long

Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, lpRect As RECT) As Long

Public Sub WipeEffect(frm As Form, lngOpt As Long, lngIncrement As Long)

Dim r As RECT
Dim lngRet As Long
Dim lngX As Long

Dim lngFormHeight As Long
Dim lngFormWidth As Long

Dim lngIncrementW As Long
Dim lngIncrementH As Long


lngRet = GetWindowRect(frm.hwnd, r)
lngFormWidth = r.right - r.left
lngFormHeight = r.bottom - r.top

lngIncrementW = lngFormWidth \ lngIncrement
lngIncrementH = lngFormHeight \ lngIncrement

Select Case lngOpt

Case 5 ' shrink/move
For lngX = 5 To lngIncrement
lngRet = MoveWindow(frm.hwnd, r.left - lngX * lngIncrementW, _
r.top + lngX * lngIncrementH, _
lngFormWidth - lngX * lngIncrementW, _
lngFormHeight - lngX * lngIncrementH, 1)
Next lngX
Case Else ' shiver
Dim lngTop As Long
Dim lngLeft As Long
Dim factor As Long
factor = 30

lngRet = MoveWindow(frm.hwnd, _
lngLeft, _
lngTop, _
lngFormWidth, _
lngFormHeight, 1)


End Select

End Sub




could someonel also explian how to tie it to a splash screen and after 7 secs to run this code?

spacepro
02-01-2004, 04:37 AM
Hi,

I have seen your other post in the forms forum. Please try not to post similair questions in different forums.

Anyway attached is the db that you downloaded, which I have modified.

Click on the open form and after 7 seconds the form will fade to one of the options, but have a look at the code on form close event which I have modified.

You should be able to use this know.

Regards

Andy

Acidburn
02-01-2004, 06:42 AM
thanks man! it works :D sorry about the double post! Erm just got 2 more things! Could you go back to the code and write dwn what most of the lines mean in green? As I'll need it in order to implement it into my IT projct but i will also include the credit to the authro of the code too. Also i was looking at it is there any lines that can be taken out to shrink it a litlle?

spacepro
02-01-2004, 02:50 PM
Most of the lines in green are just a brief explanation of what the type of transistion the code is set to in the following line:


lngOpt = 5 'Value that triggers the type of transition

This is the code with brief explanation on the form close event


Dim lngIncrement As Long 'Dimensions Increment of fade
Dim lngOpt As Long ' Dimensions the fade option

lngOpt = 5 'Value that triggers the type of transition
'2 = Value '2' will fade the form downwards
'3 = Value '3' will fade the form to the right
'4 = Value '4' will fade the form to the left
'5 = Value '5' will shrink/move the form.
'If Statement
If lngOpt >= 0 Then ' If option = 0 then
lngIncrement = 100 ' increment = 100(do nothing)
Call WipeEffect(Me, lngOpt, lngIncrement) 'Calls module and defines the variables to apply the transition
End If ' Ends the If statement


Andy