media @ VU
template-toc_end.vr
template-toc_end.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
] } ] }
Transform {
translation -12.5 7 0
children [
Shape {
appearance Appearance {
material DEF toc-mat-@id Material {
diffuseColor 1 0 0
transparency 1
}
}
geometry Box { size 3 3 0.5 }
}
DEF toc-touch-@id TouchSensor { }
] }
DEF toc-script-@id Script {
directOutput TRUE
field SFNode me USE toc-script-@id
field SFNode xswitch USE toc-switch-@id
field SFNode transform USE toc-transform-@id
field SFNode sensor USE toc-touch-@id
field SFNode mat USE toc-mat-@id
field SFInt32 state 0
eventIn SFBool touch
eventIn SFBool over
url "vrmlscript:
function initialize() {
Browser.addRoute(sensor,'isActive',me,'touch');
Browser.addRoute(sensor,'isOver',me,'over');
}
function shutdown() {
Browser.deleteRoute(sensor,'isActive',me,'touch');
Browser.deleteRoute(sensor,'isOver',me,'over');
}
function touch(value,time) {
if (value && state == 0) {
xswitch.whichChoice = 0;
transform.translation = new SFVec3f(1.5,1,0);
transform.scale = new SFVec3f(0.8,0.8,1);
state = 1;
} else if (value && state == 1) {
transform.translation = new SFVec3f(0,0,0);
transform.scale = new SFVec3f(1,1,1);
state = 2;
} else if (value && state == 2) {
xswitch.whichChoice = -1;
state = 0;
}
}
function over(value,time) {
if (value) {
mat.transparency = 0.5;
} else {
mat.transparency = 1;
}
}
"
}
</object>
</channel>
(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.