0 index
1 Justification
2 Not enough interpolators built into VRML
3 More complex interactions
4 Elements of the script node
5 eventIn
6 eventOut
7 field
8 URL
9 Using inline JS scripts
10 Organization of a script
11 Example:

outline
created using slideshow.cgi by Andy Harris















CSCI N241 Web Design: Scripts in VRML
1. Justification
  • Not enough interpolators
  • variable conversion
  • complex interactions



































CSCI N241 Web Design: Scripts in VRML
2. Not enough interpolators built into VRML
  • float to string?
  • translation to rotation?
  • Y rotation to Z rotation?
  • Circle interpolator?



































CSCI N241 Web Design: Scripts in VRML
3. More complex interactions
  • conecting switches
  • H2oComp
  • Light switch demo



































CSCI N241 Web Design: Scripts in VRML
4. Elements of the script node
  • eventIns
  • eventOuts
  • fields
  • url



































CSCI N241 Web Design: Scripts in VRML
5. eventIn
  • Name convention: set_something
  • Syntax: eventIn type name
  • Example: eventIn SFBool set_status
  • Receives values, triggers event
  • function with same name as eventIn
  • value passed as a parameter to function



































CSCI N241 Web Design: Scripts in VRML
6. eventOut
  • Name convention: something_changed
  • Syntax: eventOut type name
  • Example: eventOut SFBool status_changed
  • most scripts will assign value to eventOut
  • eventOut looks like a variable to script
  • the function's output is eventOut(s)



































CSCI N241 Web Design: Scripts in VRML
7. field
  • Name convention: any name
  • Syntax: field type name
  • Example: field SFInt32 count
  • Example: field SFNode output USE textbox



































CSCI N241 Web Design: Scripts in VRML
8. URL
  • points to script
  • javaScript .js file
  • java .class file
  • "javascript: multiline quote



































CSCI N241 Web Design: Scripts in VRML
9. Using inline JS scripts
  • Multiline quote
  • use ' or \" inside script
  • easiest way for simple scripts
  • Our preferred technique



































CSCI N241 Web Design: Scripts in VRML
10. Organization of a script
  • Function corresponding to each eventIn
  • function will have two parameters,
    • value
    • timestamp



































CSCI N241 Web Design: Scripts in VRML
11. Example:

  • eventIn SFBool value_changed
    url " javascript:
    function value_changed(val, time){
    //code goes here
    } // end function
    "



































outline

Justification

Not enough interpolators built into VRML

More complex interactions

Elements of the script node

eventIn

eventOut

field

URL

Using inline JS scripts

Organization of a script

Example: