<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:369384228;
        mso-list-type:hybrid;
        mso-list-template-ids:-2135678438 -1 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:Leonard.Daly@realism.com">Leonard Daly</a><br><b>Sent: </b>Friday, August 11, 2017 9:03 PM<br><b>To: </b><a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a><br><b>Cc: </b><a href="mailto:andreasplesch@gmail.com">Andreas Plesch</a>; <a href="mailto:yottzumm@gmail.com">John Carlson</a><br><b>Subject: </b>Script Illustrative Example [was: X3D Specification Relationshipsdiagram]</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='color:#70AD47'>I was asked by John to construct an example illustrating the items listed below. I also have replies to Andreas' comments. The original message is at the bottom (for reference). I've copied the relevant questions/statements to the top to make reading easier.<br><br>First to the example. It is located at <a href="http://tools.realism.com/development/WG-Support/2017-08-09/ScriptIllustration.html"><span style='color:#70AD47'>http://tools.realism.com/development/WG-Support/2017-08-09/ScriptIllustration.html</span></a><br>It does not use Cobweb since I can't begin to figure out how to do this in Cobweb. OTOH, if X3D is DOM integrated, then the it shouldn't matter where various functions and methods are located.<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal>Let’s see if I can extract the salient points of the link, so we know what to show in Cobweb:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><ol style='margin-top:0in' start=1 type=1><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>getElementById<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>window.requestAnimationFrame/event loop<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>setAttribute of style to set position<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Functions with time and more than 2 parameters<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Use of a field or attribute to set a function, and using window to find the function.<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Easy access to a position array.<o:p></o:p></li></ol><p class=MsoListParagraph><br>Is that all the salient points we need to show in Cobweb?  I will likely implement the whole thing anyway, and I have the feeling that it can be done, perhaps with or without the window object.<br><br><br><o:p></o:p></p><p class=MsoNormal><span style='color:#70AD47'><br>It seems to me that eval the script text each time, especially in an animation loop, is needlessly expensive. <o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal>What I currently eval each loop in X3DJSONLD are the events that need to fire for the Script to interact with ROUTEs, and probably a subset of those (TimeSensor comes to mind).   The rest of the script can be eval’ed once. I have 3 evals, one for the script and setup, one for initializeOnly routes, and one for the main event loop. The loop itself is not eval’ed and kept external. Conceivably, I could put the loop in the eval block and have it only eval once (but then it would be hard to set and clear breakpoints possibly). Each time a new X3D JSON file is loaded, the contents of the eval’s may be wiped out (they are no longer referenced, but may stick around in memory, I am not sure).  In any case, putting the event loop in the eval is a performance enhancement, and I’m not into performance at this point, debugging is more important.  I am sorry if you are criticizing my implementation, but no harm taken (thanks for the advice in fact).  A simple fix is all that is required, and has been done before.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I actually eval everything twice in X3DJSONLD, I believe, once per X3DOM canvas.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John</p><p class=MsoNormal><span style='color:#70AD47'><br><br></span><o:p></o:p></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></body></html>