#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 ThS TouchSensor {}
]
}
# タイムセンサー
DEF TiS TimeSensor {
cycleInterval 5
}
# 回転アニメ
DEF OI OrientationInterpolator {
key [ 0.0 0.25 0.5 0.75 1.0 ]
keyValue [
0 0 1 0
0 0 1 1.5708
0 0 1 3.1416
0 0 1 4.7124
0 0 1 6.2832
]
}
# カウントスクリプト
DEF Sc Script {
eventIn SFTime resetCounter
eventIn SFBool repeat
eventOut SFTime restartTime
field SFInt32 times 3 # 繰り返す回数
field SFInt32 counter 0 # 繰り返した回数
url "javascript:
function resetCounter () {
counter = 0;
}
function repeat (active,et) {
if (!active) {
counter++;
if ( counter < times ) restartTime = et;
}
}
"
}
ROUTE ThS.touchTime TO Sc.resetCounter
ROUTE TiS.isActive TO Sc.repeat
ROUTE Sc.restartTime TO TiS.startTime
ROUTE ThS.touchTime TO TiS.startTime
ROUTE TiS.fraction_changed TO OI.set_fraction
ROUTE OI.value_changed TO Cone-Tf.rotation