#VRML V2.0 utf8 ## ##@* rotation and color ##@ timer DEF TIMER TimeSensor { cycleInterval 10 loop TRUE } ##@ PROTO: cylinder (with transform) PROTO CylinderTransform [ field SFVec3f cylinderTranslation 0 0 0 field SFRotation cylinderRotation 1 0 0 1.57 eventIn SFRotation setCylinderRotation field SFColor cylinderColor 1 1 1 eventIn SFColor setCylinderColor field SFFloat cylinderRadius 3.0 field SFFloat cylinderHeight 0.2 ] ##@ proto body { Transform { translation IS cylinderTranslation rotation IS cylinderRotation set_rotation IS setCylinderRotation children [ Shape { appearance Appearance { material Material { diffuseColor IS cylinderColor set_diffuseColor IS setCylinderColor } } geometry Cylinder { radius IS cylinderRadius height IS cylinderHeight } } ] } } ##@ the scene (is a group) Group { children [ Transform { rotation 1 0 0 -1.20 children [ CylinderTransform { } ##@ orientation interpolator DEF OR_INT OrientationInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [ 0 0 1 0.0 0 0 1 -1.57 0 0 1 -3.14 0 0 1 -4.71 0 0 1 -6.28 ] } ##@ color interpolator DEF COLINT ColorInterpolator { key [0, 0.33, 0.66, 1] keyValue [ 1 0 0, 0 1 0, 0 0 1, 1 0 0 ] } ##@ the cylinder object DEF ORCYL CylinderTransform { cylinderHeight 5.0 cylinderRadius 0.8 cylinderColor 1 0 0 cylinderRotation 1 0 0 0 } ] } ] } ##@ event routing ROUTE TIMER.fraction_changed TO OR_INT.set_fraction ROUTE TIMER.fraction_changed TO COLINT.set_fraction ROUTE OR_INT.value_changed TO ORCYL.setCylinderRotation ROUTE COLINT.value_changed TO ORCYL.setCylinderColor ##