#VRML V2.0 utf8 ## ##:@* crystal proto ##- External proto for the bubble creation ##- example. The name is inherited from ##- a previous effort. ##-

##- This code may be reused in part or total. ##- Please include this paragraph when it is used. ##- Copyright 2000, Leonard Daly ##@ proto description # Prototype for a bubble. The bubble is # animated. Duration and looping of the # animation can be controlled. The color # of the bubble is also controllable. # # Fields Type Value Description # ------ ---- ----- ----------- # startTime SFTime 0 The animation start # time. The default # immediately starts # the animation. # # cycleInterval SFTime 20 The length of time # to complete a single # animation cycle. # # loop SFBool FALSE Turns on/off looping # of the animation. # # color SFColor 1 1 1 The color of the bubble. # ##@ proto PROTO SphereCrystal [ exposedField SFTime startTime 0 exposedField SFTime cycleInterval 20 exposedField SFBool loop FALSE exposedField SFColor color 1 1 1 ] { ##@ the bubble ## Define the bubble. The color is ## specified in the node definition, ## specularColor is a blue-gray. DEF Cyrstal Transform { children [ Shape { appearance Appearance { material Material { diffuseColor IS color ## specularColor .4 .4 .45 specularColor .8 .2 .25 shininess .3 transparency .6 } } geometry Sphere { radius .2 } } ] } ##@ bubble expansion ## Bubble expansion control. The time ## is set in the node declaration. DEF Timer TimeSensor { cycleInterval IS cycleInterval loop IS loop enabled TRUE startTime IS startTime stopTime 0. } DEF Grow PositionInterpolator { key [0 1] keyValue [1 1 1, 20 20 20] } ##@ event routing ## Connect the modules ROUTE Timer.fraction_changed TO Grow.set_fraction ROUTE Grow.value_changed TO Cyrstal.scale } ## End of PROTO ##@ test nodes Transform { children [ Transform { translation 1 1 1 children [ SphereCrystal {} ] } Transform { translation -1 -1 -1 children [ SphereCrystal { loop TRUE } ] } ] } ##