Академический Документы
Профессиональный Документы
Культура Документы
Outline 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 28.10 28.11 Introduction Audio and Video Adding Background Sounds with the bgsound Element Adding Video with the img Elements dynsrc Property Adding Audio or Video with the embed Element Using the Windows Media Player ActiveX Control Microsoft Agent Control RealOne Player Plug-in Synchronized Multimedia Integration Language (SMIL) Scalable Vector Graphics (SVG) Web Resources
28.2 Audio and Video Can be embedded in Web page Can be downloaded on-demand Encoding algorithm or codec
Transforms raw audio or video into a format that Web browsers can display
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. 28.1: BackgroundAudio.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>The bgsound Element</title> <bgsound id = "audio" src = "http://msdn.microsoft.com/downloads/sounds/jazzgos.mid" loop = "1"></bgsound> <script type = "text/javascript"> <!-function changeProperties() { var loop = parseInt( audioForm.loopit.value ); if ( ( loop >= -1 ) ) { audio.loop = ( isNaN( loop ) ? 1 : loop ); } else { alert( "Please enter a integer\n" + "greater than or equal to -1." ); } --> <!-- Demonstrating the bgsound element -->
Outline
BackgroundAudio .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 } }
var vol = parseInt( audioForm.vol.value ); if ( ( vol >= -10000 ) && ( vol <= 0 ) ) { audio.volume = ( isNaN( vol ) ? 0 : vol ); } else { alert( "Please enter an integer\n" + "between -10000 and 0." ); }
Outline
BackgroundAudio .html (2 of 4)
function stopSound() { if ( audioForm.stopButton.value == "Stop Sound" ) { audio.src = ""; audioForm.stopButton.value = "Start Sound"; } else { audio.src = "http://msdn.microsoft.com/downloads/sounds/jazzgos.mid"; audioForm.stopButton.value = "Stop Sound"; } // --> </script>
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
</head> <body> <h1>Background Music via the bgsound Element</h1> <h2>Jazz Gospel</h2> This sound is from the free sound downloads at the <a href = "http://msdn.microsoft.com/downloads/default.asp"> Microsoft Developer Network</a> downloads site. <hr /> Use the fields below to change the number of iterations and the volume for the audio clip<br /> Press <strong>Stop</strong> to stop playing the sound. <br />Press <strong>Refresh</strong> to begin playing the sound again. <form name = "audioForm" action = ""> <p>Loop [-1 = loop forever]</p> <input name = "loopit" type = "text" value = "1" /> <br />Volume [-10000 (low) to 0 (high)] <input name = "vol" type = "text" value = "0" /><br /> <input type = "button" value = "Set Properties" onclick = "changeProperties()" />
Outline
BackgroundAudio .html (3 of 4)
76 77 78 79
<input type = "button" value = "Stop Sound" id = "stopButton" onClick = "stopSound()" /> </form> </body>
Outline
BackgroundAudio .html (4 of 4)
80 </html>
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?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. 28.2: Dynamicimg.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>An Embedded Video Using the dynsrc Property</title> <bgsound src = "http://msdn.microsoft.com/downloads/sounds/carib.MID" loop = "-1"></bgsound> </head> <body> <h1>An Embedded Video Using the img element's dynsrc Property</h1> <h2>Car and Carribean Music</h2> <table> <tr><td><img dynsrc = "car_hi.wmv" start = "mouseover" width = "180" height = "135" loop = "-1" alt = "Car driving in circles" /></td> <td>This page will play the audio clip and video --> <!-- Demonstrating the img elements dynsrc property -->
Outline
Dynamicimg.html (1 of 2)
15 16 17 18 19 20 21 22 23 24 25
in a loop.<br />The video will not begin playing until you move the mouse over the video.<br />Press the browsers<strong>Stop</strong> button to stop playing the sound and the video.</td>
Outline
Dynamicimg.html (2 of 2)
33 </html>
28.5 Adding Audio or Video with the embed Element Element embed
Embeds media clip into Web page Displays a graphical user interface (GUI) Supported by both Microsoft Internet Explorer and Netscape
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?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. 28.3: EmbeddedAudio.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Background Audio via the embed Element</title> <style type = "text/css"> span .big { width: 600 } { color: blue; font-family: sans-serif; font-size: 50pt; font-weight: bold } </style> <script type = "text/javascript"> <!-var TimerID; var updown = true; var str = 1; --> <!-- Background Audio via the embed Element -->
Outline
EmbeddedAudio .html (1 of 3)
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 start() { TimerID = window.setInterval( "wave()", 100 ); } function wave() { if ( str > 23 || str < 1 ) updown = !updown; if ( updown ) str++; else str--; wft.filters( "wave" ).phase = str * 20; wft.filters( "wave" ).strength = str; } // --> </script> </head> <body onload = "start()"> <h1>Background Audio via the embed Element</h1> <p>Click the text to stop the script.</p>
Outline
EmbeddedAudio .html (2 of 3)
51 52 53 54 55 56 57 58 59
<p class = "big" align = "center"> <span onclick = "window.clearInterval( TimerID )" id = "wft" style = "filter:wave( add = 0, freq = 3, light = 0, phase = 0, strength = 5)"> WAVE FILTER EFFECT</p></span> <p>These controls can be used to control the audio.</p> <embed src = "humming.wav" loop = "true"></embed> </body>
Outline
EmbeddedAudio .html (3 of 3)
60 </html>
Play
Pause
Stop
Mute
Volume
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. 28.4: EmbeddedVideo.html --> <!-- Video via the embed Element <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Video via the embed Element</title> </head> <body> <h1>Displaying a Video using the embed Element</h1> <h2>Car Driving in Circles</h2> <table> <tr><td><embed src = "car_hi.wmv" loop = "false" width = "240" height = "176"> </embed></td> </tr></table> <hr /> -->
Outline
EmbeddedVideo .html (1 of 2)
12 13 14 15 16 17 18 19 20 21 22
23 24 25 26
This page plays the video once.<br /> Use the controls on the embedded video player to play the video again. </body>
Outline
EmbeddedVideo .html (2 of 2)
27 </html>
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. 28.5: MediaPlayer.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>Embedded Media Player Objects</title> <script type = "text/javascript"> <!-var videoPlaying = true; function toggleVideo( b ) { videoPlaying = !videoPlaying; b.value = videoPlaying ? "Pause Video" : "Play Video"; videoPlaying ? VideoPlayer.Play() : VideoPlayer.Pause(); } // --> </script> </head> --> <!-- Embedded Media Player Objects -->
Outline
MediaPlayer.html (1 of 3)
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> <h1> Audio and video through embedded Media Player objects </h1> <hr /> <table> <tr><td valign = "top" align = "center"> <object id = "VideoPlayer" width = "200" height = "225" classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"> <param name = "FileName" value = "car_hi.wmv" /> <param name = "AutoStart" value = "true" /> <param name = "ShowControls" value = "false" /> <param name = "Loop" value = "true" /> </object></td> <td valign = "bottom" align = "center"> <p>Use the controls below to control the audio clip.</p> <object id = "AudioPlayer" classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"> <param name = "FileName" value = "http://msdn.microsoft.com/downloads/sounds/carib.mid" /> <param name = "AutoStart" value = "true" /> <param name = "Loop" value = "true" />
Outline
MediaPlayer.html (2 of 3)
51 52 53 54 55 56 57 58
</object></td></tr> <tr><td valign = "top" align = "center"> <input name = "video" type = "button" value = "Pause Video" onclick = "toggleVideo( this )" /> </td></tr> </table> </body>
Outline
MediaPlayer.html (3 of 3)
59 </html>
28.7 Microsoft Agent Control Interactive animated characters Speaks Supports speech recognition
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. 28.6: tutorial.html --> <!-- Microsoft Agent Control <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Speech Recognition</title> <!-- Microsoft Agent ActiveX Control --> <object id = "agent" width = "0" height = "0" classid = "CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F" codebase = "#VERSION = 2, 0, 0, 0"> </object> <!-- Lernout & Hauspie TruVoice text to speech engine --> <object width = "0" height = "0" classid = "CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575" codebase = "#VERSION = 6, 0, 0, 0"> </object> -->
Outline
tutorial.html (1 of 12)
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
<!-- Microsoft Speech Recognition Engine --> <object width = "0" height = "0" classid = "CLSID:161FA781-A52C-11d0-8D7C-00A0C9034A7E" codebase = "#VERSION = 4, 0, 0, 0"> </object> <script type = "text/javascript"> <!-var currentImage = null; var tips = [ "gpp", "seo", "perf", "port", "gui", "ept", "cpe" ]; var tipNames = [ "Good Programming Practice", "Software Engineering Observation", "Performance Tip", "Portability Tip", "Look-and-Feel Observation", "Error-Prevention Tip", "Common Programming Error" ]; var voiceTips = [ "Good [Programming Practice]", "Software [Engineering Observation]", "Performance [Tip]", "Portability [Tip]",
Outline
tutorial.html (2 of 12)
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
"Look-and-Feel [Observation]", "Error-Prevention [Tip]", "Common [Programming Error]" ]; var explanations = [ // Good Programming Practice text "Good Programming Practices highlight " + "techniques for writing programs that are " + "clearer, more understandable, more " + "debuggable, and more maintainable.", // Software Engineering Observation text "Software Engineering Observations highlight " + "architectural and design issues that affect " + "the construction of complex software systems.", // Performance Tip text "Performance Tips highlight opportunities for " + "improving program performance.", // Portability Tip text "Portability Tips help students write portable " + "code that can execute in different Web browsers.", // Look-and-Feel Observation text "Look-and-Feel Observations highlight graphical " +
Outline
tutorial.html (3 of 12)
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
"user interface conventions. These observations " + "help students design their own graphical user " + "interfaces in conformance with industry " + "standards.", // Error-Prevention Tip text "Error-Prevention Tips tell people how to " + "test and debug their programs. Many of the " + "tips also describe aspects of creating Web " + "pages and scripts that reduce the likelihood " + "of 'bugs' and thus simplify the testing and " + "debugging process.", // Common Programming Error text "Common Programming Errors focus the students' " + "attention on errors commonly made by beginning " + "programmers. This helps students avoid making " + "the same errors. It also helps reduce the long " + "lines outside instructors' offices during " + "office hours!" ];
Outline
tutorial.html (4 of 12)
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
function loadAgent() { agent.Connected = true; agent.Characters.Load( "Peedy", "C:\\WINNT\\msagent\\chars\\Peedy.acs" ); actor = agent.Characters.Character( "Peedy" ); actor.LanguageID = 0x0409; // sometimes needed // get states from server actor.Get( "state", "Showing" ); actor.Get( "state", "Speaking" ); actor.Get( "state", "Hiding" ); // get Greet animation and do Peedy introduction actor.Get( "animation", "Greet" ); actor.MoveTo( screenLeft, screenTop - 90); actor.Show(); actor.Play( "Greet" ); actor.Speak( "Hello. " + "If you would like me to tell you about a " + "programming tip, click its icon, or, press " + "the 'Scroll Lock' key, and speak the name " + "of the tip, into your microphone." );
Outline
tutorial.html (5 of 12)
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 }
// get other animations actor.Get( "animation", "Idling" ); actor.Get( "animation", "MoveDown" ); actor.Get( "animation", "MoveUp" ); actor.Get( "animation", "MoveLeft" ); actor.Get( "animation", "MoveRight" ); actor.Get( "animation", "GetAttention" ); actor.Get( "animation", "GetAttentionReturn" ); // set up voice commands for ( var i = 0; i < tips.length; ++i ) actor.Commands.Add( tips[ i ], tipNames[ i ], voiceTips[ i ], true, true ); actor.Commands.Caption = "Programming Tips"; actor.Commands.Voice = "Programming Tips"; actor.Commands.Visible = true;
Outline
tutorial.html (6 of 12)
function imageSelectTip( tip ) { actor.Stop(); for ( i = 0; i < document.images.length; i++) { document.images[ i ].style.background = "lemonchiffon"; currentImage = null;
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 } }
Outline
tutorial.html (7 of 12)
function voiceSelectTip( cmd ) { var found = false; for ( var i = 0; i < tips.length; ++i ) if ( cmd.Name == tips[ i ] ) { found = true; break; } if ( found ) tellMeAboutIt( i );
function tellMeAboutIt( element ) { currentImage = document.images( element ); currentImage.style.background = "red"; spanId = document.images( element ).id + "Span";
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 } }
spanObject = document.getElementById( spanId ); actor.MoveTo( screenLeft + parseInt( spanObject.style.left ) - 18, screenTop + parseInt( spanObject.style.top )- 103 ); actor.Speak( explanations[ element ] ); // --> </script> <script type = "text/javascript" for = "agent" event = "Command( cmd )"> <!-voiceSelectTip( cmd ); // --> </script> <script type = "text/javascript" for = "agent" event = "BalloonShow"> <!-if ( currentImage != null ) { currentImage.style.background = "lemonchiffon"; currentImage = null; // --> </script>
Outline
tutorial.html (8 of 12)
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 </tr> <tr> <td align = "center" valign = "top" width = "120"> <span id = "gppSpan" style = "position : absolute; left : 30; top : 80; width : 130;"> </th> <body style = "background-color: lemonchiffon" onload = "loadAgent()"> <table border = "0"> <tr> <th colspan = "4"> <h1 style = "color: blue"> Deitel Programming Tips </h1> <script type = "text/javascript" for = "agent" event = "Click"> <!-actor.Play( "GetAttention" ); actor.Speak( "Stop poking me with that pointer!" ); actor.Play( "GetAttentionReturn" ); // --> </script> </head>
Outline
tutorial.html (9 of 12)
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
<img id = "gpp" src = "GPP_100h.gif" alt = "Good Programming Practice" border = "0" onclick = "imageSelectTip( this )" /> Good Programming Practices</span></td> <td align = "center" valign = "top" width = "120"> <span id = "seoSpan" style = "position : absolute; left : 180; top : 80; width : 130;"> <img id = "seo" src = "SEO_100h.gif" alt = "Software Engineering Observation" border = "0" onclick = "imageSelectTip( this )" /> Software Engineering Observations</span></td> <td align = "center" valign = "top" width = "120"> <span id = "perfSpan" style = "position : absolute; left : 330; top : 80; width : 130;"> <img id = "perf" src = "PERF_100h.gif" alt = "Performance Tip" border = "0" onclick = "imageSelectTip( this )" /> Performance Tips</span></td> <td align = "center" valign = "top" width = "120"> <span id = "portSpan" style = "position : absolute; left : 480; top : 80; width : 130;"> <img id = "port" src = "PORT_100h.gif" alt = "Portability Tip" border = "0" onclick = "imageSelectTip( this )" />
Outline
tutorial.html (10 of 12)
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 </tr> </tr> <tr>
Portability Tips</span></td>
Outline
<span id = "guiSpan" style = "position : absolute; left : 30; top : 260; width : 130;"> <img id = "gui" src = "GUI_100h.gif" alt = "Look-and-Feel Observation" border = "0" onclick = "imageSelectTip( this )" /> Look-and-Feel Observations</span></td>
<td align = "center" valign = "top" width = "120"> <span id = "eptSpan" style = "position : absolute; left : 180; top : 260; width : 130;"> <img id = "ept" src = "EPT_100h.gif" alt = "Error-Prevention Tip" border = "0" onclick = "imageSelectTip( this )" /> Error-Prevention Tips</span></td> <td align = "center" valign = "top" width = "12"> <span id = "cpeSpan" style = "position : absolute; left : 330; top : 260; width : 130;"> <img id = "cpe" src = "CPE_100h.gif" alt = "Common Programming Error" border = "0" onclick = "imageSelectTip( this )" /> Common Programming Errors</span></td>
</table> <img src = "agent_button.gif" style = "position: absolute; bottom: 10px; right: 10px" /> </body>
Outline
tutorial.html (12 of 12)
273 </html>
Fig. 28.7
Fig. 28.8
Fig. 28.9
Fig. 28.10
Attribute autostart
Determines whether media start playing when page loads
Attribute controls
Specifies which controls users can access
Attribute src
Set to location of streaming media
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. 28.14: StreamingMedia.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Live Media!</title> <script type = "text/javascript"> <!-var locations = [ "http://www.noaanews.noaa.gov/video/naturalworld.ram", "http://www.nasa.gov/ram/35037main_.ram"] function change( loc ) { videoControl.SetSource( locations[ loc ] ); videoControl.DoPlayPause(); } // --> </script> </head> --> <!-- Embedding RealOne Player into an XHTML page -->
Outline
StreamingMedia .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 <br /> <embed id = "videoControl" src = "" type = "audio/x-pn-realaudio-plugin" width = "275" height = "200" controls = "ImageWindow" console = "streamingAudio" autostart = "false" /> <br /> <embed id = "audioControl" src = "" type = "audio/x-pn-realaudio-plugin" width = "275" height = "40" controls = "ControlPanel" console = "streamingAudio" autostart = "false" /> <select id = "streamSelect" onchange = "change( this.value )"> <option value = "">Select a station</option> <option value = "0">NOAA</option> <option value = "1">NASA</option> </select></p> <p>Pick from my favorite video streams: <body>
Outline
StreamingMedia .html (2 of 3)
50 51 </body> 52 </html>
Outline
StreamingMedia .html (3 of 3)
28.9 Synchronized Multimedia Integration Language (SMIL) Coordinate wide range of multimedia elements XML-based description language Organize text, audio, video to occur simultaneously or sequentially Provide time reference for all instances of text and media Specifies source and presentation of multimedia
1 2 3 4 5 6 7 8 9
<smil xmlns="http://www.w3.org/2000/SMIL20/CR/Language"> <!-- Fig. 20.15 : exampleSMIL.smil --> <!-- Example SMIL Document <head> <layout> <root-layout height = "300" width = "280" background-color = "#bbbbee" title = "Example" /> <region id = "image1" width = "177" height = "230" top = "35" left = "50" background-color = "#bbbbee" /> </layout> <transition id = "wipeForward" dur = "2s" type = "barWipe" /> <transition id = "wipeBackward" dur = "2s" type = "barWipe" subtype = "topToBottom" /> <transition id = "fadeIn" dur = "2s" type = "fade" subtype = "fadeFromColor" fadeColor = "#bbbbee" /> <transition id = "fadeOut" dur = "2s" type = "fade" subtype = "fadeToColor" fadeColor = "#bbbbee" /> -->
Outline
exampleSMIL.smil (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
<transition id = "crossFade" type = "fade" subtype = "crossfade" dur = "2s" /> </head> <body> <seq> <par> <img src = "book1.jpg" region = "image1" transIn = "wipeForward" transOut = "wipeForward" alt = "book1" dur = "6s" fill = "transition" fit = "fill" /> <audio src = "bounce.au" dur = ".5s" /> </par> <par> <img src = "book2.jpg" region = "image1" transIn = "fadeIn" transOut = "fadeOut" alt = "book2" dur = "6s" fit = "fill" fill = "transition" /> <audio src = "bounce.au" dur = ".5s" /> </par> <par> <img src = "book3.jpg" region = "image1" transIn = "wipeBackward" transOut = "fadeOut" alt = "book3" dur = "6s" fit = "fill" fill = "transition" /> <audio src = "bounce.au" dur = ".5s" />
Outline
exampleSMIL.smil (2 of 3)
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
</par> <par> <img src = "book4.jpg" region = "image1" transIn = "crossFade" transOut = "fadeOut" alt = "book4" dur = "6s" fit = "fill" fill = "transition" /> <audio src = "bounce.au" dur = ".5s" /> </par> <par> <img src = "book5.jpg" region = "image1" transIn = "wipeForward" transOut = "wipeBackward" alt = "book5" dur = "6s" fit = "fill" fill = "transition" /> <audio src = "bounce.au" dur = ".5s" /> </par> <par> <img src = "book6.jpg" region = "image1" transIn = "crossFade" alt = "book6" dur = "6s" fit = "fill" fill = "transition" /> <audio src = "bounce.au" dur = ".5s" /> </par> </seq> </body>
Outline
exampleSMIL.smil (3 of 3)
73 </smil>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?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. 28.16: SMILexample.html <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Embedding SMIL with RealOne Player</title> </head> <body> <div style = "text-align: center"> <embed src = "exampleSMIL.smil" controls = "ImageWindow" type = "audio/x-pn-realaudio-plugin" width = "280" height = "300" autostart = "true"> </embed> </div> </body> --> <!-- embedding SMIL with RealOne Player -->
Outline
SMILexample.html (1 of 1)
21 </html>
28.10 Scalable Vector Graphics (SVG) Describes vector graphic data for JPEG, GIF, and PNG formats Vector graphics
Produced by mathematical equations
XML vocabulary
1 2 3 4 5 6 7 8 9 10 11
<?xml version = "1.0"?> <!-- Fig. 28.17 : shapes.svg --> <!-- Simple example of SVG <svg viewBox = "0 0 300 300" width = "300" height = "300"> <!-- Generate a background --> <g> <path style = "fill: #eebb99" d = "M0,0 h300 v300 h-300 z"/> </g> -->
Outline
shapes.svg (1 of 2)
12 13 14 15 16 17 18 19 20 21 22 23 24 25 <rect style = "fill: blue; stroke: white" x = "50" y = "0" width = "100" height = "100"> <!-- Rectangle shape and attributes --> <circle style = "fill:green;" cx = "150" cy = "150" r = "50"> <animate attributeName = "opacity" attributeType = "CSS" from = "0" to = "1" dur = "6s" </circle> /> <!-- Circle shape and attributes --> <g>
26 27 28 29 30 31 32 33 34 35 36 37 38 </g> 39 </svg>
<animate attributeName = "y" begin = "mouseover" dur = "2s" values = "0; -50; 0; 20; 0; -10; 0; 5; 0; -3; 0; 1; 0" /> </rect> <!-- Text value and attributes --> <text style = "fill: red; font-size: 24pt" x = "25" y = "250"> Welcome to SVG! <animateColor attributeName = "fill" attributeType = "CSS" values = "red;blue;yellow;green;red" dur = "10s" repeatCount = "indefinite"/> </text>
Outline
shapes.svg (2 of 2)
1 2 3 4 5 6 7 8 9 10
<?xml version = "1.0"?> <!-- Fig. 28.18: planet.svg <svg viewBox = "-500 -500 1000 1000"> <g id = "background"> <path style = "fill: black" d = "M -2000,-2000 H 2000 V 2000 H -2000 Z" /> </g> <circle id = "sun" style = "fill: yellow" cx = "0" cy = "0" r = "100" /> <g> <animateTransform attributeName = "transform" type = "rotate" dur = "80s" from = "0" to = "360" repeatCount = "indefinite" /> <circle id = "earth" style = "fill: blue" cx = "400" cy = "0" r = "40" /> <g transform = "translate( 400 0 )"> <circle id = "moon" style = "fill: white" cx = "70" cy = "0" r = "10"> --> <!-- Planetary motion with SVG -->
Outline
planet.svg (1 of 2)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 </g> </g>
<animateTransform attributeName = "transform" type = "rotate" dur = "20s" from = "360" to = "0" repeatCount = "indefinite" /> </circle>
Outline
planet.svg (2 of 2)
32 </svg>