animator
<3dobject>
DEF @tid-time TimeSensor { cycleInterval 4 loop TRUE }
DEF @tid-script Script {
directOutput TRUE
eventIn SFTime touch
eventIn SFTime time
eventOut SFFloat transparency
field SFNode video USE @tid-ch-1
field SFNode text1 USE @tid-t-1
field SFNode text2 USE @tid-t-2
field SFNode block USE @tid-MAT
field MFString string []
field SFInt32 state 0
field SFInt32 notify 0
url "javascript:
function time(value) {
if (notify==0) {
notify = 1;
} else if (notify==1) {
touch(value);
notify++;
} else if (notify==2) {
touch(value);
notify++;
}
}
function touch(value) {
if (state == 0) {
string = text1.string;
text1.string = text2.string[0];
text1.alpha = 0;
text2.alpha = 1;
state = 1;
} else if (state == 1) {
text1.alpha = 1;
block.transparency = 1;
state = 2;
} else if (state == 2) {
text1.string = string;
text1.alpha = 0;
block.transparency = 0.6;
state = 3;
} else if (state == 3) {
video.stopTime = value;
state = 4;
} else if (state == 4) {
video.stopTime = 0;
video.startTime = value;
state = 0;
}
}
"
}
ROUTE @tid-touch.touchTime TO @tid-script.touch
##ROUTE @tid-time.cycleTime TO @tid-script.time
DEF @tid-time TimeSensor { loop TRUE cycleInterval 5 }
DEF @tid-colors ColorInterpolator {
key [ 0 0.5 1 ]
keyValue [ 0 1 0, 1 0 0 ,1 0 1 ]
}
DEF @tid-scalar ScalarInterpolator {
key [ 0 0.5 1 ]
keyValue [ 0 0.5 1 ]
}
DEF @tid-back ColorInterpolator {
key [ 0 0.5 1 ]
keyValue [ 1 1 0, 0 1 0 ,0 1 1 ]
}
DEF @tid-rotation OrientationInterpolator {
key [ 0 0.5 1]
keyValue [ 1 1 0 0, 1 1 0 1.56 , 1 1 0 3.14 ]
}
ROUTE @tid-time.fraction TO @tid-rotation.fraction
ROUTE @tid-rotation.value TO @tid-o-1.rotation
</3dobject>
</image>