Special form-to-form transitions...possible?

Special form-to-form transitions...possible?

Post by John Straff » Thu, 22 Aug 1996 04:00:00



The folks we've had in for user testing of our
GUI seem to be occasionally getting lost going
from form to form.  The GUI designer would like
an animation to indicate that the new form "came
from" a certain spot or action and the example
he used was the Macintosh's "zoombox" command.  
If you're not familiar with this effect, take a
look at the effect Win95 has when minimizing or
maximizing a form... it appears to shrink into or
grow from the "start bar".  What we'd like to do
is this sort of effect but from a specific point
on the screen.  Is there any way to do this in
VB4, maybe using a API call or two, or is there
any 3rd Party package that will allow this kind
(or other kinds) of form-to-form transitions?

- John C. Straffin


<><

 
 
 

Special form-to-form transitions...possible?

Post by Monume » Fri, 23 Aug 1996 04:00:00


: The folks we've had in for user testing of our
: GUI seem to be occasionally getting lost going
: from form to form.  The GUI designer would like
: an animation to indicate that the new form "came
: from" a certain spot or action and the example
: he used was the Macintosh's "zoombox" command.  
: If you're not familiar with this effect, take a
: look at the effect Win95 has when minimizing or
: maximizing a form... it appears to shrink into or
: grow from the "start bar".  What we'd like to do
: is this sort of effect but from a specific point
: on the screen.  Is there any way to do this in
: VB4, maybe using a API call or two, or is there
: any 3rd Party package that will allow this kind
: (or other kinds) of form-to-form transitions?

This might be a hack, but then again, it might be just what you are
looking for.  The following code will accomplish what you want.  On a
slow machine, this will look like stir-fried sh*t, but hey, it works.

It is called from the SECOND Form's "Form_Load" procedure.  (Load the
form normally from the first form)  Here is the call syntax

Call explode(Form1, Form2, 10, True)

This will explode Form2 from Form1, using 10 "frames", and unloading
Form1 at the end of the procedure.  On my 386-20, the processor
couldn't keep up with the screen refresh rate, so it looked pretty
bad, but if you were running a quicker machine, it would work quite
well I would think.  Play with it, especially the number of frames to
use.

By the way, no I don't have way too much time on my hands, I could
concievably use this on my own projects, so I coded it quickly for my
own use.  ;)

===begin EXPLODE.BAS===
'Copyright (C) 1996 Jeff Goslin
Option Explicit

Sub explode (StartFrm As Form, EndFrm As Form, ByVal Iterations As Integer, ByVal QUnloadStartForm As Integer)
    'declare variables
    Dim CurrHeight, CurrWidth, CurrTop, CurrLeft As Single
    Dim ChgHeight, ChgWidth, ChgTop, ChgLeft As Single
    Dim c As Integer

    'don't show the end form yet
    EndFrm.Visible = False

    'calculate movement rates, Height, Width, Top and Left
    ChgHeight = (EndFrm.Height - StartFrm.Height) / Iterations
    ChgWidth = (EndFrm.Width - StartFrm.Width) / Iterations
    ChgTop = (EndFrm.Top - StartFrm.Top) / Iterations
    ChgLeft = (EndFrm.Left - StartFrm.Left) / Iterations

    'initialize current values to start form values
    CurrHeight = StartFrm.Height
    CurrWidth = StartFrm.Width
    CurrTop = StartFrm.Top
    CurrLeft = StartFrm.Left

    'set initial endform values and display
    EndFrm.Height = CurrHeight
    EndFrm.Width = CurrWidth
    EndFrm.Top = CurrTop
    EndFrm.Left = CurrLeft
    EndFrm.Visible = True

    'adjust the screen sizes
    For c = 1 To Iterations
        CurrHeight = CurrHeight + ChgHeight
        CurrWidth = CurrWidth + ChgWidth
        CurrTop = CurrTop + ChgTop
        CurrLeft = CurrLeft + ChgLeft
        EndFrm.Height = CurrHeight
        EndFrm.Width = CurrWidth
        EndFrm.Top = CurrTop
        EndFrm.Left = CurrLeft
        EndFrm.Refresh
    Next c

    'unload start form?
    If QUnloadStartForm = True Then Unload StartFrm

    'done
End Sub

===end EXPLODE.BAS===

--
 ----------------------------------------------------------------------------
|          Jeff Goslin - Monument           | "Oh Bentson, you are so        |

|                                           |  ravages of intellect."        |
| http://www.acs.oakland.edu/links/jggoslin |   --Evil, The Time Bandits     |
 ----------------------------------------------------------------------------
|   how come everyone elses religion is a cult but your cult is a religion   |
 ----------------------------------------------------------------------------