media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

web3d-x-crystal.vr

web3d-x-crystal.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

Web3D/VR

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


  
  
  
  
  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


  
  
  
  
  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


  
  
  ROUTE        Timer.fraction_changed        TO        Grow.set_fraction
  ROUTE        Grow.value_changed        TO        Cyrstal.scale
  }
  
  
  
  
  
  Transform {
    children [
      Transform {
        translation 1 1 1
        children [
          SphereCrystal {}
        ]
      }
      Transform {
        translation -1 -1 -1
        children [
          SphereCrystal {
            loop TRUE
          }
        ]
      }
    ]
  }
  
  


(C) A. Eliëns 21/5/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.