| Fades provide a smooth link between frames in your game. There are four main types of fades; blending fades, such as "Smooth", mask fades, sush as "Masks", covering fades, such as "Clutter" and manipulative fades, such as "Jelly". These types can also be mixed together to make more complex effects.
Applying fades is fairly simple. It involves 1) Creating a fade object, and 2) Applying it to a level as a fade in or fade out.
Starting with a simple project:
| | | | |
oJAM = New JAM( );
MyFrame1 = oJAM.Storyboard.NewFrame( Startup1, Code1, End1 );
MyFrame2 = oJAM.Storyboard.NewFrame( Startup2, Code2, End2 );
oJAM.Run( );
Function Startup1( ){ }
Function Code1( )
{
oJAM.Storyboard.SwapFrame( MyFrame2 );
}
Function End1( ){ }
Function Startup2( ){ }
Function Code2( ){ }
Function End2( ){ }
| | | |
A transition can be added between the frames to make it more interesting.
Firstly, the transition(s) are created. This can be at any point before the frames are set up. For this example, only "Clutter" will be used:
| | | | |
fade1 = New Fade_Clutter( );
| | | |
Some fades can be set up through their constructors, some can be set up through functions called later on, and some have no settings to change. Take a look at the individual fade's pages for details.
Now, the frame creation line can be changed to:
| | | | |
MyFrame2 = oJAM.Storyboard.NewFrame( Startup2, Code2, End2, fade1, 2000 );
| | | |
This adds the clutter as a fade in for frame 2, and sets it's duration to 2000 milliseconds (2 seconds)
It can also be added as a fade out for frame 1:
| | | | |
MyFrame1 = oJAM.Storyboard.NewFrame( Startup1, Code1, End1, , , fade1, 2000 );
| | | |
Note that there are 3 commas between the functions and the fade. This is to avoid JAM confusing it for a fade in.
It is also possible to provide fades in the SwapFrame event, allowing different fades for different circumstances. Replace the current SwapFrame event for this one:
| | | | |
oJAM.Storyboard.SwapFrame( MyFrame2, fade1, 10000 );
| | | |
(the same fade will be used, but it will last for 10 seconds instead of 2)
You can create as many fade objects as you want, and use any combination of fade-ins or outs.
JAM © 2005 no one in particular Project started by David Evans in 2005 | |