Table of Contents Previous Directory Viewpoint Slideshow    Directory Viewpoint Slideshow Javadoc for translated java source Next Directory Viewpoint Slideshow X3D Resources

X3D Example Archives: VRML 2 Sourcebook, Chapter 30 Scripts

[1] Figure30_1ScriptSlidingBall.x3d sliding ball
Directory Viewpoint Slideshow
Figure 30.4 Script Spiraling Ball Trace

Scripts allow authors to define their own event-handling code to improve animation sophistication.

Many actions are too complex for animation 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.

5 X3D Models                 15 X3D Model Viewpoint Snapshots

Figure30_1ScriptSlidingBall
Figure 30 1 Script Sliding Ball.x3d    
[1] Figure30_1ScriptSlidingBall.x3d sliding ball
[2] Figure30_1ScriptSlidingBall.x3d (default X3D view from 0 0 10)

Figure30_2ScriptBackgroundSelect
Figure 30 2 Script Background Select.x3d    
[3] Figure30_2ScriptBackgroundSelect.x3d Background select
[4] Figure30_2ScriptBackgroundSelect.x3d (default X3D view from 0 0 10)

Figure30_3ScriptSoundActivate
Figure 30 3 Script Sound Activate.x3d    
[5] Figure30_3ScriptSoundActivate.x3d toggle sound by clicking ball
[6] Figure30_3ScriptSoundActivate.x3d move left spatialize right
[7] Figure30_3ScriptSoundActivate.x3d move right spatialize left
[8] Figure30_3ScriptSoundActivate.x3d outside maximum attenuation ellipsoid
[9] Figure30_3ScriptSoundActivate.x3d (default X3D view from 0 0 10)

Figure30_4ScriptSpiralingBallTrace
Figure 30 4 Script Spiraling Ball Trace.x3d    
[10] Figure30_4ScriptSpiralingBallTrace.x3d spiraling ball
[11] Figure30_4ScriptSpiralingBallTrace.x3d view from above
[12] Figure30_4ScriptSpiralingBallTrace.x3d side view
[13] Figure30_4ScriptSpiralingBallTrace.x3d (default X3D view from 0 0 10)

Figure30_5ScriptTorusBuilder
Figure 30 5 Script Torus Builder.x3d    
[14] Figure30_5ScriptTorusBuilder.x3d Torus
[15] Figure30_5ScriptTorusBuilder.x3d (default X3D view from 0 0 10)
 

This viewpoint slideshow is online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/viewpointSlideshow.html

Validate XHTML 1.1

Viewpoint image version history at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/_viewpoints

Table of Contents Previous Directory Viewpoint Slideshow    Directory Viewpoint Slideshow Javadoc for translated java source Next Directory Viewpoint Slideshow X3D Resources