Package Vrml2Sourcebook.Chapter30Scripts
Scripts allow authors to define their own event-handling code to improve animation sophistication.
Sometimes animation actions are too complex for interpolator nodes, such as computed animation paths (e.g. gravity), algorithmic shapes (e.g. fractals), or collaborative environments (e.g. games). You can create new sensors, interpolators, etc., using program scripts written in Java (a powerful general-purpose language) or ECMAscript (JavaScript, an easy-to-learn language). The Script node selects a program script, specified by a url or contained source code. Program scripts have field and event interface declarations, each with a data type, a name, and an initial value (for fields only).
These X3D scenes are adapted directly from the original VRML 2.0 Sourcebook chapter examples. Also available: Introduction to VRML97 SIGGRAPH98 course notes.
This X3D VRML2 Sourcebook Chapter 30 Scripts examples archive is online.
The X3D Java Scene Access Interface (x3djsail) package provides concrete classes for each X3D node and statement.
Online: X3D Java Scene Access Interface Library (X3DJSAIL) and X3DJSAIL Javadoc
- See Also:
-
ClassDescriptionA sliding red sphere and a custom interpolation script.Click on a geometric Shape to change the scene Background.A pair of filter scripts used to create a toggle on-off switch.A spiraling red sphere and a custom interpolation script.A torus shape built with a donut-maker program script.