Index Topic Contents |
DVD Overlay
The DVD Overlay sample demonstrates the potential of integrating three-dimensional (3-D) content with digital video disc (DVD) playback using a scripting language and the framework provided by Microsoft® Internet Explorer 5, the Microsoft Windows Media™ Player control, and Microsoft DirectAnimation.
Technical Information
This sample consists of two HTML pages layered on top of each other. Default.htm contains an embedded Windows Media Player control for DVD playback and the code that calls the overlay portion of the sample, Drag.htm.
<DIV ID=Top STYLE="visibility: visible; position: absolute; width: 100%; height: 100%;"> <IFRAME NAME="DAPage" SRC="../samples/overlayDVD/drag.htm" WIDTH=100% HEIGHT=100% SCROLLING=NO MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0 VSPACE=0 NORESIZE > </IFRAME> </DIV>DVD-Video appears in the background because the Windows Media Player is embedded in a DIV tag. This enables IFRAME content, in this case Drag.htm, to be layered over the DIV containing the Windows Media Player control. The IFRAME functions as a document within a document.
Drag.htm, layered over Default.htm, provides the DirectAnimation portion of the sample, containing the 3-D playback controls (.x files) and their animation behaviors.
Note You can layer any static or dynamic HTML content over DVD-Video; you don't have to use DirectAnimation.
Operating Instructions
To operate this sample, right-click and drag the player controls that appear at the bottom of the page across the page and over the DVD-Video. The player controls indicate the state of the player by changing color. When DVD playback is paused, the player controls spin. To view this sample, click the following button. To view this sample, your system must be capable of DVD-Video playback and have the Microsoft® DirectShow® drivers installed.
To view the source code for Default.htm, click the following link.
Sample Code
<HTML> <HEAD> <TITLE>DirectAnimation/DVD Overlay, JScript sample</TITLE> <SCRIPT LANGUAGE="JScript"> <!-- /*************************************************************************/ /* Global Variables */ /*************************************************************************/ var giScanRate = 1; var gbPause = false; /*************************************************************************/ /* Function: InitDVD */ /* Description: Sets color key */ /*************************************************************************/ function InitDVD(){ DVD.DVD.ColorKey = 0x100010; }/* end of function InitDVD */ /*************************************************************************/ /* Function: FullScreen_onclick */ /*************************************************************************/ function FullScreen_onclick() { // DVD.FullScreenMode =-1; }/* end of function Stop_onclick */ /*************************************************************************/ /* Function: StartPlay */ /* Description: Starts the playback. */ /*************************************************************************/ function StartPlay(){ window.setTimeout("DVD.Play();", 3500 , "JavaScript"); // better to handle onReady }/* end of function StartPlay */ /*************************************************************************/ /* Function: Init */ /* Description: Initialize the DVD and DA and start playing. */ /*************************************************************************/ function Init(){ DAPage.StartAnimation(); InitDVD(); StartPlay(); }/* end of function Init */ /*************************************************************************/ /* Function: Play */ /* Description: Play the current DVD title. */ /*************************************************************************/ function Play(){ if((1 != giScanRate) && (0 != giScanRate)){ giScanRate = 1; DVD.DVD.ForwardScan(giScanRate); }/* end of if statement */ DVD.Play(); gbPause = false; // turn the pause off }/* end of function Play */ /*************************************************************************/ /* Function: Stop */ /* Description: Stop playing. */ /*************************************************************************/ function Stop(){ DVD.Stop(); giScanRate = 0; gbPause = true; }/* end of function Stop */ /*************************************************************************/ /* Function: Pause */ /* Description: Pause or unpause the playback. */ /*************************************************************************/ function Pause(){ if(gbPause == false){ DVD.Pause(); gbPause = true; } else { Play(); gbPause = false; }/* end of if statement */ }/* end of function Pause */ /*************************************************************************/ /* Function: Forward */ /* Description: Forward the presentation. */ /*************************************************************************/ function Forward(){ if(0 == giScanRate){ Play(); giScanRate = 8; // have to wait till play kicks in window.setTimeout('DVD.DVD.ForwardScan(giScanRate);', 2000); return; }/* end of if statement */ if(gbPause == true) Pause(); giScanRate = 8; DVD.DVD.ForwardScan(giScanRate); }/* end of function Forward */ /*************************************************************************/ /* Function: Rewind */ /* Description: Rewind the presentation. /*************************************************************************/ function Rewind(){ if(0 == giScanRate){ Play(); giScanRate = -8; // have to wait till play kicks in window.setTimeout('DVD.DVD.BackwardScan(-giScanRate);', 2000); return; }/* end of if statement */ if(gbPause == true) Pause(); giScanRate = -8; DVD.DVD.BackwardScan(-giScanRate); }/* end of function Rewind */ /*************************************************************************/ /* Function: Menu */ /* Description: Invokes DVD Menu. Needs to swap the z-order so the */ /* menu can get the foscus. */ /*************************************************************************/ function Menu(){ DVD.DVD.MenuCall(3); }/* end of function Menu */ /*************************************************************************/ /* Function: IsDVDActive */ /* Description: Checks whenever we are paused. */ /*************************************************************************/ function IsDVDActive(){ return(!gbPause); }/* end of function IsDVDActive */ //--> </SCRIPT> <SCRIPT LANGUAGE="JavaScript" FOR="DVD" EVENT="DVDNotify(Event, Param1, Param2)"> <!-- switch (Event){ case 265: // EC_DVD_STILL_ON if(Param1 == 0){ // have menu with buttons, so have to interact gbPause = true; // hide the DA control in order to show the menu Top.style.visibility="hidden"; } break; case 266: // EC_DVD_STILL_OFF if(Top.style.visibility=="hidden"){ // show the DA control since the menu is out Top.style.visibility="visible"; DAPage.SetPlayState(); }/* end of if statement */ break; case 272: // EC_DVD_PLAYBACK_RATE_CHANGE giScanRate = Param1 / 10000; // reset the state, just in case switch(giScanRate){ case -8: DAPage.SetRewindState(); break; case 8: DAPage.SetForwardState(); break; case 1: DAPage.SetPlayState(); break; }/* end of switch statement */ break; //default: window.alert("unhandled event " + Event); }/* end of switch statement */ --> </SCRIPT> </HEAD> <BODY OnLoad="Init()" bgColor="#100010"> <DIV ID="Background" STYLE="visibility: visible; position: absolute; width: 100%; height: 100%;" > <P ALIGN="center"> <OBJECT ID="DVD" STYLE="position:absolute; top:80px; left:40px;" WIDTH="652" HEIGHT="480" STANDBY="Loading Microsoft® Windows® Media Player components..." TYPE="application/x-oleobject" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" > <PARAM NAME="Filename" VALUE="DVD:"> <PARAM NAME="AutoStart" VALUE="0"> <PARAM NAME="ShowControls" VALUE="0"> <PARAM NAME="ShowPositionControls" VALUE="-1"> <PARAM NAME="ShowStatusBar" VALUE="0"> </OBJECT> </P> </DIV> <DIV ID=Top STYLE="visibility: visible; position: absolute; width: 100%; height: 100%;" > <IFRAME NAME="DAPage" SRC="../samples/overlayDVD/drag.htm" WIDTH=100% HEIGHT=100% SCROLLING=NO MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0 VSPACE=0 NORESIZE > </IFRAME> </DIV> </BODY> </HTML>To view the source code for Drag.htm, click the following link.
Sample Code
<HTML> <HEAD> <TITLE>DirectAnimation/DVD Overlay, JScript sample</TITLE> </HEAD> <BODY BGCOLOR="#100010" LINK="#100010" TOPMARGIN=15 LEFTMARGIN=20 OnResize="SetSize()" > <OBJECT ID="DAControl" WIDTH=100% HEIGHT=100% ALIGN=LEFT CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D" > </OBJECT> <SCRIPT language="JScript"> <!-- /*************************************************************************/ /* Description: This page is meant to be overalayed on top of the WMP. */ /* You can drag the 3-D controls with the right button. When one is */ /* selected it animates the color. When pause or menu is selected the */ /* 3-D controls spin. */ /*************************************************************************/ /*************************************************************************/ /* Constants */ /*************************************************************************/ var cm = 0.01; // a conversion factor from centimeters to meters var dim = 3*cm; // all coordinates are specified in meters var pi = Math.PI; // for specifying angles in radian var DefWidth = 984.0; // default width coded for var DefHeight = 602.0; // default height coded for /*************************************************************************/ /* Global variables */ /*************************************************************************/ var m = DAControl.MeterLibrary; // initialize the meter library var GrabEventMenuR, ReleaseEventMenuR, GrabEventPlayR, ReleaseEventPlayR; var GrabEventPauseR, ReleaseEventPauseR, GrabEventRewindR, ReleaseEventRewindR; var GrabEventForwardR, ReleaseEventForwardR; var EvOnMenu, EvOnPlay, EvOnPause, EvOnRewind, EvOnForward; var EvOffMenu, EvOffPlay, EvOffPause, EvOffRewind, EvOffForward; var lastEvent = null; var EvOnRotate = m.AppTriggeredEvent(); var EvOffRotate = m.AppTriggeredEvent(); var YLoc = m.ModifiableBehavior(ConvertY(-0.075)); // y location where the buttons are located var ModelScale = m.ModifiableBehavior(ConvertY(0.008));// scale the model with the y axes var XLocPlay = m.ModifiableBehavior(ConvertX(-0.1)); // scale the x location var XLocPause = m.ModifiableBehavior(ConvertX(-0.05)); // scale the x location var XLocRewind = m.ModifiableBehavior(ConvertX(0.0)); // scale the x location var XLocForward = m.ModifiableBehavior(ConvertX(0.05)); // scale the x location var XLocMenu = m.ModifiableBehavior(ConvertX(0.1)); // scale the x location var strPrevEvent = "play"; var RoateEventOn = m.AppTriggeredEvent(); var RotateEventOff = m.AppTriggeredEvent(); var mouseX, mouseY; // Draggable Image Component var PositionMenu = m.Point2Anim(XLocMenu,YLoc); var PositionPlay = m.Point2Anim(XLocPlay,YLoc); var PositionPause = m.Point2Anim(XLocPause,YLoc); var PositionRewind = m.Point2Anim(XLocRewind,YLoc); var PositionForward = m.Point2Anim(XLocForward,YLoc);; /*************************************************************************/ /* Function: CheckDAVersion */ /* Description: Checks the version of DA. */ /* Returns true of OK, or false if the version is older. */ /*************************************************************************/ function CheckDAVersion(){ floatVersion = parseFloat(m.VersionString); if(floatVersion < 6.01){ window.alert("Old version of DA " + m.VersionString + ". The sample will not work."); return false; }/* end of if statement */ return true; }/* end of function CheckDAVersion */ /*******************************************************************************/ /* Function: ChaeckIE5Version */ /* Description: Tests if browser is IE 5.0 or higher */ /* Returns true if IE 5.0 or higher, false otherwise. */ /*******************************************************************************/ function ChaeckIE5Version() { var ua = window.navigator.userAgent; var index = ua.lastIndexOf("MSIE"); if (index != -1) { if (parseFloat(ua.substr(index+4,3)) >= 5.0) { return(true); // have IE 5.0 or higher }/* end of if statement */ }/* end of if statement */ window.alert("Old version of IE " + m.VersionString + ". The sample will not work."); return(false); }/* end of function ChaeckIE5Version */ /*************************************************************************/ /* Global initialization */ /*************************************************************************/ DAControl.AddBehaviorToRun(m.MousePosition.X.AnimateProperty("mouseX", "JScript", false, 0.1)); DAControl.AddBehaviorToRun(m.MousePosition.Y.AnimateProperty("mouseY", "JScript", false, 0.1)); // Note: lowering the time value increases the CPU load but makes dragging look better /*************************************************************************/ /* Function: ConvertX */ /* Description: Converts the set default coordinate to current size. *. /*************************************************************************/ function ConvertX(X){ return(m.DANumber(document.body.clientWidth * X / DefWidth)); }/* end of function ConvertX */ /*************************************************************************/ /* Function: ConvertY */ /* Description: Converts the set default coordinate to current size. *. /*************************************************************************/ function ConvertY(Y){ return(m.DANumber(document.body.clientHeight * Y/ DefHeight)); }/* end of function ConvertY */ /*************************************************************************/ /* Function: SetSize */ /* Descriptions: Gets called when window is resized the moded needs to */ /* be updated. */ /*************************************************************************/ function SetSize(){ YLoc.SwitchTo(ConvertY(-0.075)); ModelScale.SwitchTo(ConvertY(0.009)); XLocPlay.SwitchTo(ConvertX(-0.1)); XLocPause.SwitchTo(ConvertX(-0.05)); XLocRewind.SwitchTo(ConvertX(0)); XLocForward.SwitchTo(ConvertX(0.05)); XLocMenu.SwitchTo(ConvertX(0.1)) }/* end of function SetSize */ /*************************************************************************/ /* Function: SignalEvent */ /* Description: Turns off last event, and turns the new event on */ /*************************************************************************/ function SignalEvent(NewEvent, NewEventOff, strNewEvent){ if(strNewEvent != strPrevEvent){ if(null != lastEvent){ m.TriggerEvent(lastEvent,m.DANumber(0)); lastEvent = null; }/* end of if statement */ m.TriggerEvent(NewEvent,m.DANumber(0)); } else { switch(strNewEvent){ case "play": break; default: NewEventOff = EvOffPlay; // case when toggeling off from pause NewEvent = EvOnPlay; strNewEvent = "Play"; break; }/* end of if statement */ if(null != lastEvent){ m.TriggerEvent(lastEvent,m.DANumber(0)); lastEvent = null; }/* end of if statement */ m.TriggerEvent(NewEvent,m.DANumber(0)); // play }/* end of if statement */ strPrevEvent = strNewEvent; lastEvent = NewEventOff; }/* end of function SignalEvent */ /*************************************************************************/ /* Function: Menu */ /* Description: Invokes command on the DVD page and sets the state of */ /* the 3-D control. */ /*************************************************************************/ function Menu() { SignalEvent(EvOnMenu, EvOffMenu, "Menu"); PrevEventType = "Menu"; window.parent.Menu(); m.TriggerEvent(RoateEventOn,m.DANumber(0)); }/* end of function Menu */ /*************************************************************************/ /* Function: Play */ /* Description: Invokes command on the DVD page and sets the state of */ /* the 3-D control. */ /*************************************************************************/ function Play(){ window.parent.Play(); SetPlayState(); }/* end of function Play */ /*************************************************************************/ /* Function: SetPlayState */ /* Description: Sets the state of the 3-D control. */ /*************************************************************************/ function SetPlayState(){ SignalEvent(EvOnPlay, EvOffPlay, "Play"); m.TriggerEvent(RotateEventOff,m.DANumber(0)); }/* end of function SetPlayState */ /*************************************************************************/ /* Function: Pause */ /* Description: Invokes command on the DVD page and sets the state of */ /* the 3-D control. */ /*************************************************************************/ function Pause(){ SignalEvent(EvOnPause, EvOffPause, "Pause"); window.parent.Pause(); m.TriggerEvent(RoateEventOn,m.DANumber(0)); }/* end of function Pause */ /*************************************************************************/ /* Function: Rewind */ /* Description: Invokes command on the DVD page which then sets a state. */ /*************************************************************************/ function Rewind(){ window.parent.Rewind(); }/* end of function Rewind */ /*************************************************************************/ /* Function: Forward */ /* Description: Invokes command on the DVD page, which then sets a state.*/ /*************************************************************************/ function Forward(){ window.parent.Forward(); }/* end of function Forward */ /*************************************************************************/ /* Function: SetRewindState */ /* Description: Sets state on the 3-D buttons. */ /*************************************************************************/ function SetRewindState(){ SignalEvent(EvOnRewind, EvOffRewind, "Rewind"); m.TriggerEvent(RotateEventOff,m.DANumber(0)); }/* end of function SetRewindState */ /*************************************************************************/ /* Function: SetForwardState */ /* Description: Sets the state on the 3-D buttons. */ /*************************************************************************/ function SetForwardState(){ SignalEvent(EvOnForward, EvOffForward, "Forward"); m.TriggerEvent(RotateEventOff,m.DANumber(0)); }/* end of function SetForwardState */ /*************************************************************************/ /* Function: GrabProcMenuR */ /*************************************************************************/ function GrabProcMenuR() { var GrabPos = m.UntilNotifyScript(m.Point2(mouseX, mouseY), GrabEventMenuR, "ReleaseProcMenuR"); return GrabPos; }/* end of function GrabProcMenuR */ /*************************************************************************/ /* Function: ReleaseProcMenuR */ /*************************************************************************/ function ReleaseProcMenuR() { var ReleasePos = m.UntilNotifyScript(m.MousePosition, ReleaseEventMenuR, "GrabProcMenuR"); return ReleasePos; }/* end of function ReleaseProcMenuR */ /*************************************************************************/ /* Function: GrabProcPlayR */ /*************************************************************************/ function GrabProcPlayR(){ var GrabPos = m.UntilNotifyScript(m.Point2(mouseX, mouseY), GrabEventPlayR, "ReleaseProcPlayR"); return GrabPos; }/* end of function GrabProcPlayR */ /*************************************************************************/ /* Function: ReleaseProcPlayR */ /*************************************************************************/ function ReleaseProcPlayR() { var ReleasePos = m.UntilNotifyScript(m.MousePosition, ReleaseEventPlayR, "GrabProcPlayR"); return ReleasePos; }/* end of function ReleaseProcPlayR */ /*************************************************************************/ /* Function: GrabProcPauseR */ /*************************************************************************/ function GrabProcPauseR(){ var GrabPos = m.UntilNotifyScript(m.Point2(mouseX, mouseY), GrabEventPauseR, "ReleaseProcPauseR"); return GrabPos; }/* end of function GrabProcPauseR */ /*************************************************************************/ /* Function: ReleaseProcPauseR */ /*************************************************************************/ function ReleaseProcPauseR(){ var ReleasePos = m.UntilNotifyScript(m.MousePosition, ReleaseEventPauseR, "GrabProcPauseR"); return ReleasePos; }/* end of function ReleaseProc */ /*************************************************************************/ /* Function: GrabProcRewindR */ /*************************************************************************/ function GrabProcRewindR(){ var GrabPos = m.UntilNotifyScript(m.Point2(mouseX, mouseY), GrabEventRewindR, "ReleaseProcRewindR"); return GrabPos; }/* end of function GrabProcRewindR */ /*************************************************************************/ /* Function: ReleaseProcRewindR */ /*************************************************************************/ function ReleaseProcRewindR(){ var ReleasePos = m.UntilNotifyScript(m.MousePosition, ReleaseEventRewindR, "GrabProcRewindR"); return ReleasePos; }/* end of function ReleaseProcRewindR */ /*************************************************************************/ /* Function: GrabProcForwardR */ /*************************************************************************/ function GrabProcForwardR(){ var GrabPos = m.UntilNotifyScript(m.Point2(mouseX, mouseY), GrabEventForwardR, "ReleaseProcForwardR"); return GrabPos; }/* end of function GrabProcForwardR */ /*************************************************************************/ /* Function: ReleaseProcForwardR */ /*************************************************************************/ function ReleaseProcForwardR() { var ReleasePos = m.UntilNotifyScript(m.MousePosition, ReleaseEventForwardR, "GrabProcForwardR"); return ReleasePos; }/* end of function ReleaseProcForwardR */ /*************************************************************************/ /* Function: ImportGeo */ /* Description: Creates a geometry used in the model. */ /* Parameters: */ /* Geometry the x geometry used */ /* TextImage the image used for texture map */ /*************************************************************************/ function ImportGeo(Geometry, EvOn, EvOff, clr1, bRotateXOnly){ // Import raw geometry and change its color to Green var geoRaw = m.ImportGeometry(Geometry); // color animation var clr2 = m.ColorHslAnim(m.Div(m.LocalTime,m.DANumber(8)), m.DANumber(1), m.DANumber(0.5)); var clr = new ActiveXObject("DirectAnimation.DAColor"); clr.Init(m.Until(clr1, EvOn, m.Until(clr2, EvOff, clr))); geoRaw = geoRaw.DiffuseColor(clr); var geoStat = geoRaw.Transform(m.Compose3(m.Scale3UniformAnim(ModelScale), m.Rotate3(m.Vector3(1,0,0), pi/9))); var rotTrans; if(bRotateXOnly){ rotTrans = m.Rotate3Rate(m.XVector3, pi/6); } else { rotTrans = m.Compose3(m.Rotate3Rate(m.YVector3, pi/8), m.Rotate3Rate(m.XVector3, pi/6)); }/* end of if statement */ // construct a Geometry that spins around the Z and X axis. var geoRot = geoRaw.Transform(m.Compose3(rotTrans, m.Scale3UniformAnim(ModelScale))); var geoStatRot = new ActiveXObject("DirectAnimation.DAGeometry"); geoStatRot.Init(m.Until(geoStat, RoateEventOn, m.Until(geoRot, RotateEventOff, geoStatRot))); // Make it pickable var geoPick = geoStatRot.Pickable(); return(geoPick); }/* end of function ImportGeo */ /*************************************************************************/ /* Function: CreateGeometryMenu */ /* Description: Creates Geometry that you can drag and which triggers */ /* appropriate scripted function. */ /*************************************************************************/ function CreateGeometryMenu(){ EvOnMenu = m.AppTriggeredEvent(); EvOffMenu = m.AppTriggeredEvent(); var geoPickMenu = ImportGeo("Menu.x", EvOnMenu, EvOffMenu, m.Blue, false); var GrabEventMenu = m.AndEvent(geoPickMenu.PickEvent, m.LeftButtonDown); GrabEventMenuR = m.AndEvent(geoPickMenu.PickEvent, m.RightButtonDown); ReleaseEventMenuR = m.RightButtonUp; PositionMenu = m.UntilNotifyScript(PositionMenu, GrabEventMenuR, "ReleaseProcMenuR"); var PickGeometryMenu = new ActiveXObject("DirectAnimation.DAGeometry"); PickGeometryMenu.Init(m.Until(geoPickMenu.Geometry,GrabEventMenu.ScriptCallback("Menu()", "JScript"),m.Until(geoPickMenu.Geometry,EvOffMenu,PickGeometryMenu))); var geoModelMenu = m.UnionGeometry(PickGeometryMenu, m.PointLight.Transform(m.Translate3Anim(XLocMenu,YLoc, m.DANumber(.22)))); return(geoModelMenu); }/* end of function CreateGeometryMenu */ /*************************************************************************/ /* Function: CreateGeometryPlay */ /* Description: Creates Geometry that you can drag and which triggers */ /* appropriate scripted function. */ /*************************************************************************/ function CreateGeometryPlay(){ EvOnPlay = m.AppTriggeredEvent(); EvOffPlay = m.AppTriggeredEvent(); var geoPickPlay = ImportGeo("play.x", EvOnPlay, EvOffPlay, m.Red, true); var GrabEventPlay = m.AndEvent(geoPickPlay.PickEvent, m.LeftButtonDown); GrabEventPlayR = m.AndEvent(geoPickPlay.PickEvent, m.RightButtonDown); ReleaseEventPlayR = m.RightButtonUp; PositionPlay = m.UntilNotifyScript(PositionPlay, GrabEventPlayR, "ReleaseProcPlayR"); var PickGeometryPlay = new ActiveXObject("DirectAnimation.DAGeometry"); PickGeometryPlay.Init(m.Until(geoPickPlay.Geometry,GrabEventPlay.ScriptCallback("Play()", "JScript"),m.Until(geoPickPlay.Geometry,EvOffPlay,PickGeometryPlay))); var geoModelPlay = m.UnionGeometry(PickGeometryPlay, m.DirectionalLight); return(geoModelPlay); }/* end of function CreateGeometryPlay */ /*************************************************************************/ /* Function: CreateGeometryPause */ /* Description: Creates Geometry that you can drag and which triggers */ /* appropriate scripted function. */ /*************************************************************************/ function CreateGeometryPause(){ EvOnPause = m.AppTriggeredEvent(); EvOffPause = m.AppTriggeredEvent(); var geoPickPause = ImportGeo("pause.x", EvOnPause, EvOffPause, m.Green, false); var GrabEventPause = m.AndEvent(geoPickPause.PickEvent, m.LeftButtonDown); GrabEventPauseR = m.AndEvent(geoPickPause.PickEvent, m.RightButtonDown); ReleaseEventPauseR = m.RightButtonUp; PositionPause = m.UntilNotifyScript(PositionPause, GrabEventPauseR, "ReleaseProcPauseR"); var PickGeometryPause = new ActiveXObject("DirectAnimation.DAGeometry"); PickGeometryPause.Init(m.Until(geoPickPause.Geometry,GrabEventPause.ScriptCallback("Pause()", "JScript"),m.Until(geoPickPause.Geometry,EvOffPause, PickGeometryPause))); var geoModelPause = m.UnionGeometry(PickGeometryPause, m.DirectionalLight); return(geoModelPause); }/* end of function CreateGeometryPause */ /*************************************************************************/ /* Function: CreateGeometryRewind */ /* Description: Creates Geometry that you can drag and which triggers */ /* appropriate scripted function. */ /*************************************************************************/ function CreateGeometryRewind(){ EvOnRewind = m.AppTriggeredEvent(); EvOffRewind = m.AppTriggeredEvent(); var geoPickRewind = ImportGeo("rewind.x", EvOnRewind, EvOffRewind, m.Olive, true); var GrabEventRewind = m.AndEvent(geoPickRewind.PickEvent, m.LeftButtonDown); GrabEventRewindR = m.AndEvent(geoPickRewind.PickEvent, m.RightButtonDown); ReleaseEventRewindR = m.RightButtonUp; PositionRewind = m.UntilNotifyScript(PositionRewind, GrabEventRewindR, "ReleaseProcRewindR"); var PickGeometryRewind = new ActiveXObject("DirectAnimation.DAGeometry"); PickGeometryRewind.Init(m.Until(geoPickRewind.Geometry,GrabEventRewind.ScriptCallback("Rewind()", "JScript"),m.Until(geoPickRewind.Geometry,EvOffRewind,PickGeometryRewind))); var geoModelRewind = m.UnionGeometry(PickGeometryRewind, m.DirectionalLight); return(geoModelRewind); }/* end of function CreateGeometryRewind */ /*************************************************************************/ /* Function: CreateGeometryForward */ /* Description: Creates Geometry that you can drag and which triggers */ /* appropriate scripted function. */ /*************************************************************************/ function CreateGeometryForward(){ EvOnForward = m.AppTriggeredEvent(); EvOffForward = m.AppTriggeredEvent(); var geoPickForward = ImportGeo("forward.x", EvOnForward, EvOffForward, m.Gray, true); var GrabEventForward = m.AndEvent(geoPickForward.PickEvent, m.LeftButtonDown); GrabEventForwardR = m.AndEvent(geoPickForward.PickEvent, m.RightButtonDown); ReleaseEventForwardR = m.RightButtonUp; PositionForward = m.UntilNotifyScript(PositionForward, GrabEventForwardR, "ReleaseProcForwardR"); var PickGeometryForward = new ActiveXObject("DirectAnimation.DAGeometry"); PickGeometryForward.Init(m.Until(geoPickForward.Geometry,GrabEventForward.ScriptCallback("Forward()", "JScript"),m.Until(geoPickForward.Geometry,EvOffForward,PickGeometryForward))); var geoModelForward = m.UnionGeometry(PickGeometryForward, m.DirectionalLight); return(geoModelForward); }/* end of function CreateGeometryForward */ /*************************************************************************/ /* Function: CreateAnimation */ /* Description: Creates the DA Animation. (But does not start it). */ /*************************************************************************/ function CreateAnimation(){ if(!(CheckDAVersion() && ChaeckIE5Version())) return(false); // do not have the right versions of sofware // load up and create individual 3D controls var geoModelMenu = CreateGeometryMenu(PositionMenu); var geoModelPlay = CreateGeometryPlay(PositionPlay); var geoModelPause = CreateGeometryPause(PositionPause); var geoModelRewind = CreateGeometryRewind(PositionRewind); var geoModelForward = CreateGeometryForward(PositionForward); // Add the camera var camera = m.PerspectiveCamera(dim*5, dim + 0.1*cm); // initialize the camera var imgGeoMenu = geoModelMenu.Render(camera); var imgGeoPlay = geoModelPlay.Render(camera); var imgGeoPause = geoModelPause.Render(camera); var imgGeoRewind = geoModelRewind.Render(camera); var imgGeoForward = geoModelForward.Render(camera); //Add the transform for grabbing var realblockMenu = imgGeoMenu.Transform(m.Translate2Point(PositionMenu)); var realblockPlay = imgGeoPlay.Transform(m.Translate2Point(PositionPlay)); var realblockPause = imgGeoPause.Transform(m.Translate2Point(PositionPause)); var realblockRewind = imgGeoRewind.Transform(m.Translate2Point(PositionRewind)); var realblockForward = imgGeoForward.Transform(m.Translate2Point(PositionForward)); var realblock = m.OverlayArray( new Array( realblockMenu, realblockPlay, realblockPause, realblockRewind, realblockForward)); // By default we are playing, so set our state to start with SignalEvent(EvOnPlay, EvOnPlay, "Play"); DAControl.Image = realblock; return(true); }/* end of function CreateAnimation */ /*************************************************************************/ /* Function: StartAnimation */ /* Description: Starts the animation */ /*************************************************************************/ function StartAnimation(){ DAControl.Start(); // start the animation }/* end of function StartAnimation */ // create the animation CreateAnimation(); // StartAnimation is being called from DVD page now, left here for debugging purposes. */ //StartAnimation(); //--> </SCRIPT> </BODY> </HTML>
Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.