Transition Numbers - Page 4
August 23, 2002
There are 22 different transitions to choose from. There is also
transition 23, which chooses a number at random. I just happen to
like 12.
And no, you do not need both transitions set to 12. It can be two
different numbers. Table 3.1 describes the magic 23 numbers.
Table 3.1 Transition Effects
| Number | What Happens |
| 1 | Reveals from inside out |
| 2 | Scrolls in from outer parts |
| 3 | Scrolls out from the center |
| 4 | Scrolls up from the button |
| 5 | Scrolls down from the top |
| 6 | Scrolls left to the right |
| 7 | Scrolls right to the left |
| 8 | Displays vertical blinds left to right |
| 9 | Displays horizontal blinds top to bottom |
| 10 | Displays a combination of 8 and 9 |
| 11 | Looks a lot like 8 |
| 12 | Comes in, in pixels |
| 13 | Scrolls in from outer parts |
| 14 | Scrolls out from the center |
| 15 | Closes from both the top and bottom |
| 16 | Opens from center to top and bottom |
| 17 | Displays a diagonal roll from right to
left |
| 18 | Displays a different angle diagonal roll
right to left |
| 19 | Displays number 17 the other way |
| 20 | Displays number 18 the other way |
| 21 | Displays random horizontal lines |
| 22 | Displays random vertical lines |
| 23 | Displays completely random |
After Transition 23, the cycle of effects appears to start over.
Any one will work just fine. Some are just more interesting than
others.
Make It Go Away
There are really two things to discuss when it comes to reversing
the effect: simply setting the current script to go the opposite way
and putting a second revealTrans() on a page.
If all you want to do is make the script and SPAN previously noted
to go from invisible to visible, it's simple. Everywhere you see
the word "visible", you change it to "hidden"; and everywhere you
see the word "hidden", you change it to "visible". Don't forget to
change the instance in the SPAN as well.
But what if you want to put a second revealTrans() on the same
page? You can, but you need to do two things.
First, you need to set a new function name in the script. I chose
goAway() for my second function name. Then you need to update that
name in the Form Button onClick Event Handler.
Then there's the NAME= in the SPAN. Remember how we named the SPAN
in the original script Egg1? Well, that NAME connected the SPAN
and the JavaScript. This means that if you put another
revealTrans() on a page, the first name is dead and cannot be used
by anything else. Thus, you have to change the name of the SPAN
and each time that name appears in the script.
Here's a hint to do it quickly: Copy the script and previous SPAN
on to a separate text editor, like WordPad or SimpleText. Then,
choose Replace from the Edit menu. Type in the current name of the
SPAN and then what you would like the new name to be and choose to
Replace All. Bingo! It's done.
Now you can copy the new script and SPAN and paste it wherever you
want it. No sweat! That's what I had to do here. I went with the
name Egg2. Clever, huh?
The following code is the second script and SPAN from before. It
has a new function name, a new NAME for the SPAN-which has also
been changed throughout the script-and is set to go in the opposite
direction of the first revealTrans(). The transitions are still
set to 12, though. I really do like that number:
<SCRIPT LANGUAGE="javascript">
function goAgain()
{
Egg2.filters[0].Apply();
if (Egg2.style.visibility == "hidden")
{
Egg2.style.visibility = "visible";
Egg2.filters.revealTrans.transition=12;
}
else {
Egg2.style.visibility = "hidden";
Egg2.filters[0].transition=12;
}
Egg2.filters[0].Play();
}
</SCRIPT>
<INPUT TYPE=button VALUE="Lemme See It" onClick="goAgain();">
<SPAN ID=Egg2 Style="Visibility:hidden;
Filter:revealTrans(duration=2);width:179;height:110"> <IMG SRC="eggs.gif">
</SPAN>
No Button
As you can probably tell, using a button to start the effect is
not very useful. Just remember that as long as the effect can be
surrounded by a SPAN and an Event Handler is used to trigger the
function, this can be triggered any number of ways. An onLoad
Event Handler can trigger the effect when the page loads. You
could also set the effect to trigger using an onMouseOver as
illustrated in Figure 3.5.
|
Pass Your Mouse Over This
Thank you!
Figure 3.5
|
See the text "Thank You!" coming in?
By the way, I got the effect to occur in less than a second by setting the duration to .25. Faster than that seemed to kill the effect.
RevealTrans Filter - Page 3
Beyond HTML Goodies
Internet Explorer Text and Image Filters - Page 5
|