Filters and Transitions
Filters and Transitions
Filters and Transitions
Outline
15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 15.10 15.11 15.12 15.13 Introduction Flip Filters: flipv and fliph Transparency with the chroma Filter Creating Image masks Miscellaneous Image Filters: invert, gray and xray Adding shadows to Text Creating Gradients with alpha Making Text glow Creating Motion with blur Using the wave Filter Advanced Filters: dropShadow and light blendTrans Transition revealTrans Transition
Transitions
Temporary Allow transfer from one page to another with pleasant visual effect
For example, random dissolve
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Fig. 15.1: flip.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>The flip filter</title> <style type = "text/css"> body { background-color: #CCFFCC } --> <!-- Using the flip filters -->
Outline
flip.html (1 of 2)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 </style> </head> td { border-style: groove; padding: 1ex } table { font-size: 3em; font-family: Arial, sans-serif; background-color: #FFCCCC; border-style: ridge ; border-collapse: collapse }
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<body> <table> <tr> <!-- Filters are applied in style declarations --> <td style = "filter: fliph">Text</td> <td>Text</td> </tr> <tr> <!-- More than one filter can be applied at once --> <td style = "filter: flipv fliph">Text</td> <td style = "filter: flipv">Text</td> </tr> </table> </body>
Outline
flip.html (2 of 2)
45 </html>
fliph filterapplied
Nofiltersapplied
flipv filterapplied
dynamically
Without using a graphics editor to hard-code transparency into the image
onchange
Fires when the value of a form changes
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.2: chroma.html <!-- Applying transparency using the chroma filter <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Chroma Filter</title> <script type = "text/javascript"> <!-function changecolor( theColor ) { if ( theColor ) { // if the user selected a color, parse the // value to hex and set the filter color. chromaImg.filters( "chroma" ).color = theColor; chromaImg.filters( "chroma" ).enabled = true; } else // if the user selected "None", // disable the filter. chromaImg.filters( "chroma" ).enabled = false; } --> -->
Outline
chroma.html (1 of 3)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 <body>
Outline
chroma.html (2 of 3)
<h1>Chroma Filter:</h1> <img id = "chromaImg" src = "trans.gif" style = "position: absolute; filter: chroma" "Transparent Image" /> <form action = ""> <!-- The onchange event fires when --> <!-- a selection is changed <option value = "">None</option> <option value = "#00FFFF">Cyan</option> <option value = "#FFFF00">Yellow</option> <option value = "#FF00FF">Magenta</option> <option value = "#000000" selected = "selected"> Black</option> </select> </form> --> <select onchange = "changecolor( this.value )"> alt =
51
</body>
52 </html>
Outline
chroma.html (3 of 3)
15.4 Creating Image masks Background is a solid color Foreground is transparent to the image or color behind it
1 2 3 4 5 6 7 8 9 10 11
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.3: mask.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Mask Filter</title> </head> <body> <h1>Mask Filter</h1> <!-- Filter parameters are specified in parentheses, --> <!-- in the form param1 = value1, param2 = value2, <!-- etc. <div style = "position: absolute; top: 125; left: 20; filter: mask( color = #CCFFFF )"> <h1 style = "font-family: Courier, monospace"> AaBbCcDdEeFfGgHhIiJj<br /> KkLlMmNnOoPpQqRrSsTt </h1> --> --> --> <!-- Placing a mask over an image -->
Outline
mask.html (1 of 2)
12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30
</div> <img src = "gradient.gif" width = "400" height = "200" alt = "Image with Gradient Effect" /> </body>
Outline
mask.html (2 of 2)
31 </html>
gray filter
Grayscale image effect
All color is stripped from the image, only brightness data remains
xray filter
X-ray effect
Inversion of the grayscale effect
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Fig 15.4: misc.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Misc. Image filters</title> <style type = "text/css"> .cap { font-weight: bold; background-color: #DDDDAA; text-align: center } </style> </head> <body> <table class = "cap"> <tr> <td>Normal</td> <td>Grayscale</td> </tr> <tr> --> <!-- Image filters to invert, grayscale or xray an image -->
Outline
misc.html (1 of 2)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 </body> 47 </html>
<td><img src = "hc.jpg" alt = "normal scenic view" /></td> <td><img src = "hc.jpg" style = "filter: gray" alt = "gray scenic view"/> </td> </tr> <tr> <td>Xray</td> <td>Invert</td> </tr> <tr> <td><img src = "hc.jpg" style = "filter: xray" alt = "xray scenic view"/> </td> <td><img src = "hc.jpg" style = "filter: invert" alt = "inverted scenic view"/> </td> </tr> </table>
Outline
misc.html (2 of 2)
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Fig 15.5: shadow.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Shadow Filter</title> <script type = "text/javascript"> <!-var shadowDirection = 0; function start() { window.setInterval( "runDemo()", 500 ); } function runDemo() { shadowText.innerText = "Shadow Direction: " + shadowDirection % 360; --> <!-- Applying the shadow filter -->
Outline
shadow.html (1 of 2)
11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 </html> }
shadowText.filters( "shadow" ).direction = ( shadowDirection % 360 ); shadowDirection += 45; // --> </script> </head> <body onload = "start()"> <h1 id = "shadowText" style = "position: absolute; top: 25; left: 25; padding: 10; filter: shadow( direction = 0, color = red )">Shadow Direction: 0</h1> </body>
Outline
shadow.html (2 of 2)
style
Uniform opacity (value 0) Linear gradient (value 1) Circular gradient (value 2) Rectangular gradient (value 3)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Fig 15.6: alpha.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Alpha Filter</title> <script type = "text/javascript"> <!-function run() { pic.filters( "alpha" ).opacity = opacityButton.value; pic.filters( "alpha" ).finishopacity = opacityButton2.value; pic.filters( "alpha" ).style = styleSelect.value; } // --> </script> </head> <body> --> <!-- Applying the alpha filter to an image -->
Outline
alpha.html (1 of 3)
23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
<div id = "pic" style = "position: absolute; left:0; top: 0; filter: alpha( style = 2, opacity = 100, finishopacity = 0 )"> <img src = "flag.gif" alt = "Flag" /> </div> <table style = "position: absolute; top: 250; left: 0; background-color: #CCFFCC" border = "1"> <tr> <td>Opacity (0-100):</td> <td><input type = "text" id = "opacityButton" size = "3" maxlength = "3" value = "100" /></td> </tr> <tr> <td>FinishOpacity (0-100):</td> <td><input type = "text" id = "opacityButton2" size = "3" maxlength = "3" value = "0" /></td> </tr> <tr> <td>Style:</td> <td><select id = "styleSelect">
Outline
alpha.html (2 of 3)
<option value = "1">Linear</option> <option value = "2" selected = "selected"> Circular</option> <option value = "3">Rectangular</option> </select></td>
Outline
alpha.html (3 of 3)
<td align = "center" colspan = "2"> <input type = "button" value = "Apply" onclick = "run()" /> </td> </tr> </table>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.7: glow.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Glow Filter</title> <script type = "text/javascript"> <!-var strengthIndex = 1; var counter = 1; var upDown = true; var colorArray = [ "FF0000", "FFFF00", "00FF00", "00FFFF", "0000FF", "FF00FF" ]; function apply() { glowSpan.filters( "glow" ).color = parseInt( glowColor.value, 16 ); glowSpan.filters( "glow" ).strength = glowStrength.value; } --> <!-- Applying the glow filter -->
Outline
glow.html (1 of 4)
25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
function startdemo() { window.setInterval( "rundemo()", 150 ); } function rundemo() { if ( upDown ) { glowSpan.filters( "glow" ).strength = strengthIndex++; } else { glowSpan.filters( "glow" ).strength = strengthIndex--; } if ( strengthIndex == 1 ) { upDown = !upDown; counter++; glowSpan.filters( "glow" ).color = parseInt( colorArray[ counter % 6 ], 16 ); } if ( strengthIndex == 10 ) { upDown = !upDown;
Outline
glow.html (2 of 4)
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 }
} // --> </script> </head> <body style = "background-color: #00AAAA"> <h1>Glow Filter:</h1> <span id = "glowSpan" style = "position: absolute; left: 200;top: 100; padding: 5; filter: glow( color = red, strength = 5 ); font-size: 2em"> Glowing Text </span> <table border = "1" style = "background-color: #CCFFCC"> <tr> <td>Color (Hex)</td> <td><input id = "glowColor" type = "text" size = "6" maxlength = "6" value = "FF0000" /></td> </tr> <tr> <td>Strength (1-255)</td> <td><input id = "glowStrength" type = "text" size = "3" maxlength = "3" value = "5" />
Outline
glow.html (3 of 4)
76 77 78 79 80 81 82 83 84 85 86 87 </body> 88 </html>
</td> </tr> <tr> <td colspan = "2"> <input type = "button" value = "Apply" onclick = "apply()" /> <input type = "button" value = "Run Demo" onclick = "startdemo()" /></td> </tr> </table>
Outline
glow.html (4 of 4)
Direction
Determines in which direction the blur filter is applied
strength
Determines how strong the blurring effect is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.8: blur.html --> <!-- The blur filter <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Blur Filter</title> <script type = "text/javascript"> <!-var strengthIndex = 1; var blurDirection = 0; var upDown = 0; var timer; function reBlur() { blurImage.filters( "blur" ).direction = document.forms( "myForm" ).Direction.value; blurImage.filters( "blur" ).strength = document.forms( "myForm" ).Strength.value; blurImage.filters( "blur" ).add = document.forms( "myForm" ).AddBox.checked; -->
Outline
blur.html (1 of 5)
17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
} function startDemo() { timer = window.setInterval( "runDemo()", 5 ); } function runDemo( ) { document.forms( "myForm" ).Strength.value = strengthIndex; document.forms( "myForm" ).Direction.value = ( blurDirection % 360 ); if ( strengthIndex == 35 || strengthIndex == 0 ) upDown = !upDown; blurImage.filters( "blur" ).strength = ( upDown ? strengthIndex++ : strengthIndex-- ); if ( strengthIndex == 0 ) blurImage.filters( "blur" ).direction = ( ( blurDirection += 45 ) % 360 ); } // -->
Outline
blur.html (2 of 5)
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
</script> </head> <body> <form name = "myForm" action = ""> <table border = "1" style = "background-color: #CCFFCC"> <caption>Blur filter controls</caption> <tr> <td>Direction:</td> <td><select name = "Direction"> <option value = "0">above</option> <option value = "45">above-right</option> <option value = "90">right</option> <option value = "135">below-right</option> <option value = "180">below</option> <option value = "225">below-left</option> <option value = "270">left</option> <option value = "315">above-left</option> </select></td> </tr> <tr> <td>Strength:</td>
Outline
blur.html (3 of 5)
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
<td><input name = "Strength" size = "3" type = "text" maxlength = "3" value = "0" /></td> </tr> <tr> <td>Add original?</td> <td><input type = "checkbox" name = "AddBox" /></td> </tr> <tr> <td align = "center" colspan = "2"> <input type = "button" value = "Apply" onclick = "reBlur();" /></td> </tr> <tr> <td colspan = "2"> <input type = "button" value = "Start demo" onclick = "startDemo();" /> <input type = "button" value = "Stop demo" onclick = "window.clearInterval( timer );" /></td> </tr> </table> </form>
Outline
blur.html (4 of 5)
101 102 103 104 105 106 107 108 109 110 </body> 111 </html> </div> <div id = "blurImage" style = "position: absolute; top: 0; left: 300; padding: 0; filter: blur( add = 0, direction = 0, strength = 0 ); background-color: white;"> <img align = "middle" src = "shapes.gif" alt = "Shapes" />
Outline
blur.html (5 of 5)
freq
Determines the frequency of the wave applied
phase
Indicates the phase shift of the wave
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.9: wave.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Wave Filter</title> <script type = "text/javascript"> <!-var wavePhase = 0; function start() { window.setInterval( "wave()", 5 ); } function wave() { wavePhase++; flag.filters( "wave" ).phase = wavePhase; } --> <!-- Applying the wave filter -->
Outline
wave.html (1 of 2)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
// --> </script> </head> <body onload = "start();"> <span id = "flag" style = "align: center; position: absolute; left: 30; padding: 15; filter: wave(add = 0, freq = 1, phase = 0, strength = 10); font-size: 2em"> Here is some waaaavy text </span> </body>
Outline
wave.html (2 of 2)
41 </html>
light filters
Most powerful and advanced filter in Internet Explorer 6.0 Allows simulation of a light source shining on Web page All parameters and methods are set by scripting
addPoint Adds a point light source
2004 Prentice Hall, Inc. All rights reserved.
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig. 15.10: dropshadow.html <!-- Using the light filter with the dropshadow filter <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>DHTML dropShadow and light Filters</title> <script type = "text/javascript"> <!-function setlight( ) { dsImg.filters( "light" ).addPoint( 150, 150, 125, 255, 255, 255, 100 ); } function run() { eX = event.offsetX; eY = event.offsetY; --> -->
Outline
dropshadow.html (1 of 3)
11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 }
xCoordinate = Math.round( eX-event.srcElement.width / 2, 0 ); yCoordinate = Math.round( eY-event.srcElement.height / 2, 0 ); dsImg.filters( "dropShadow" ).offx = xCoordinate / -3; dsImg.filters( "dropShadow" ).offy = yCoordinate / -3; dsImg.filters( "light" ).moveLight( 0, eX, eY, 125, 1 ); // --> </script> </head> <body onload = "setlight()" style = "background-color: green"> <img id = "dsImg" src = "circle.gif" style = "top: 100; left: 100; filter: dropShadow( offx = 0, offy = 0, color = black ) light()" onmousemove = "run()" alt = "Circle Image" />
Outline
dropshadow.html (2 of 3)
49
</body>
50 </html>
Outline
dropshadow.html (3 of 3)
1 2 3 4 5 6 7 8 9
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.11: conelight.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>Cone lighting</title> <script type = "text/javascript"> var upDown = true; var counter = 0; var moveRate = -2; function setLight() { marquee.filters( "light" ).addCone( 0, marquee.height, 8, marquee.width / 2, 30, 255, 150, 255, 50, 15 ); marquee.filters( "light" ).addCone( marquee.width, marquee.height, 8, 200, 30, 150, 255, 255, 50, 15 ); marquee.filters( "light" ).addCone( marquee.width / 2, marquee.height, 4, 200, 100, 255, 255, 150, 50, 50 ); window.setInterval( "display()", 100 ); --> <!-- Automating the cone light source -->
Outline
conelight.html (1 of 3)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
} function display() { counter++; if ( ( counter % 30 ) == 0 ) upDown = !upDown; if ( ( counter % 10 ) == 0 ) moveRate *= -1; if ( upDown ) { marquee.filters( "light" ).moveLight( 0, -1, -1, 3, 0 ); marquee.filters( "light" ).moveLight( 1, 1, -1, 3, 0 ); marquee.filters( "light" ).moveLight( 2, moveRate, 0, 3, 0); } else { marquee.filters( "light" ).moveLight( 0, 1, 1, 3, 0 ); marquee.filters( "light" ).moveLight( 1, -1, 1, 3, 0 );
Outline
conelight.html (2 of 3)
Outline
conelight.html (3 of 3)
<body style = "background-color: #000000" onload = "setLight()"> <img id = "marquee" src = "marquee.gif" style = "filter: light; position: absolute; left: 25; top: 25" alt = "Deitel movie marquee" />
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Fig 15.12: blendtrans.html --> <!-- Blend transition <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Using blendTrans</title> <script type = "text/javascript"> <!-function blendOut() { textInput.filters( "blendTrans" ).apply(); textInput.style.visibility = "hidden"; textInput.filters( "blendTrans" ).play(); } // --> </script> </head> -->
Outline
blendtrans.html (1 of 2)
11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31 </body> 32 </html> <div id = "textInput" onclick = "blendOut()" style = "width: 300; filter: blendTrans( duration = 3 )"> <h1>Some fading text</h1> </div> <body>
Outline
blendtrans.html (2 of 2)
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig 15.13: blendtrans2.html --> <!-- Blend Transition <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Blend Transition II</title> <script type = "text/javascript"> <!-var whichImage = true; function blend() { if ( whichImage ) { image1.filters( "blendTrans" ).apply(); image1.style.visibility = "hidden"; image1.filters( "blendTrans" ).play(); } else { image2.filters( "blendTrans" ).apply(); image2.style.visibility = "hidden"; -->
Outline
blendtrans2.html (1 of 3)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 } } } } }
Outline
blendtrans2.html (2 of 3)
function reBlend( fromImage ) { if ( fromImage ) { image1.style.zIndex -= 2; image1.style.visibility = "visible"; else { image1.style.zIndex += 2; image2.style.visibility = "visible";
whichImage = !whichImage; blend(); // --> </script> </head> <body style = "color: darkblue; background-color: lightblue" onload = "blend()">
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
<h1>Blend Transition Demo</h1> <img id = "image2" src = "cool12.jpg" onfilterchange = "reBlend( false )" style = "position: absolute; left: 50; top: 50; width: 300; filter: blendTrans( duration = 4 ); z-index: 1" alt = "First Transition Image" <img id = "image1" src = "cool8.jpg" onfilterchange = "reBlend( true )" style = "position: absolute; left: 50; top: 50; width: 300; filter: blendTrans( duration = 4 ); z-index: 2" alt = "Second Transition Image" </body> /> />
Outline
blendtrans2.html (3 of 3)
66 </html>
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Fig. 15.14: revealtrans.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>24 DHTML Transitions</title> <script type = "text/javascript"> <!-var transitionName = ["Box In", "Box Out", "Circle In", "Circle Out", "Wipe Up", "Wipe Down", "Wipe Right", "Wipe Left", "Vertical Blinds", "Horizontal Blinds", "Checkerboard Across", "Checkerboard Down", "Random Dissolve", "Split Vertical In", "Split Vertical Out", "Split Horizontal In", "Split Horizontal Out", "Strips Left Down", "Strips Left Up", "Strips Right Down", "Strips Right Up", "Random Bars Horizontal", "Random Bars Vertical", "Random" ]; --> <!-- Cycling through 24 transitions -->
Outline
revealtrans.html (1 of 4)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 if ( fromImage ) { image1.style.zIndex -= 2; image1.style.visibility = "visible"; function reBlend( fromImage ) { counter++; } } } else { image2.filters( "revealTrans" ).apply(); image2.style.visibility = "hidden"; image2.filters( "revealTrans" ).play(); function blend() { if ( whichImage ) { image1.filters( "revealTrans" ).apply(); image1.style.visibility = "hidden"; image1.filters( "revealTrans" ).play(); var counter = 0; var whichImage = true;
Outline
revealtrans.html (2 of 4)
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 } } }
image2.filters( "revealTrans" ).transition = counter % 24; else { image1.style.zIndex += 2; image2.style.visibility = "visible"; image1.filters( "revealTrans" ).transition = counter % 24;
Outline
revealtrans.html (3 of 4)
whichImage = !whichImage; blend(); transitionDisplay.innerHTML = "Transition " + counter % 24 + ": " + transitionName[ counter % 24 ]; // --> </script> </head> <body style = "color: white; background-color: lightcoral" onload = "blend()">
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
<img id = "image2" src = "icontext.gif" style = "position: absolute; left: 10; top: 10; width: 300; z-index:1; visibility: visible; filter: revealTrans( duration = 2, transition = 0 )" onfilterchange = "reBlend( false )" alt = "Programming Tips" /> <img id = "image1" src = "icons2.gif" style = "position: absolute; left: 10; top: 10; width: 300; z-index:1; visibility: visible; filter: revealTrans( duration = 2, transition = 0 )" onfilterchange = "reBlend( true )" alt = "Icons" /> <div id = "transitionDisplay" style = "position: absolute; top: 70; left: 80">Transition 0: Box In</div> </body>
Outline
revealtrans.html (4 of 4)
91 </html>