loop_1.wrl source
#VRML V2.0 utf8

Viewpoint {}

NavigationInfo {
type "EXAMINE"
}

# 赤円錐
DEF Cone-Tf Transform {
children [
Transform {
translation 3 0 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 1 0 0
}
}
geometry Cone {
height 0.5
bottomRadius 0.2
}
}
]
}
]
}

# タイムセンサー
DEF TiS TimeSensor {
loop TRUE
cycleInterval 5
}

DEF Sc Script {
eventIn SFFloat set_fraction
eventOut SFRotation rotation
field SFFloat pi2 6.28
url "javascript:

function initialize () {

pi2 = 2 * Math.PI;
rotation = new SFRotation ( 0, 0, 1, 0 );

}

function set_fraction (f) {

rotation.angle = pi2 * f;

}

"
}

ROUTE TiS.fraction_changed TO Sc.set_fraction
ROUTE Sc.rotation TO Cone-Tf.rotation