update
function update(value) {
if (tick == 0) {
tick = value;
}
while (tick < value) {
change(tick);
tick = tick + 0.1;
}
tick = value;
}
function change(value) {
var r, phi, x, y, z;
var i, j, idx;
var frac;
frac = 2.0 * value;
state += 1;
if (frac > 1.0) frac = 2.0 - frac;
frac = 0.0 + frac;
// Compute coordinates, texture coordinates:
//if (state > phase) state = 0;
//if (state == 1) {
if (1) for (i = 0; i < nlat ; i++) {
//y = 2 * ( i / (nlat-1) ) - 1;
y = 2 * ( i / (nlat-1) ) - 1;
r = Math.sqrt( 1 - y*y ) - 0.1 * (1.0 - frac);
for (j = 0; j < nl; j++) {
phi = 2 * Math.PI * j / nl;
x = -Math.sin(phi)*r;
x = x-1.0*(1.0-frac);
c[i*nl+j].x = x;
}
}
if (1) for (i = 0; i < nlat ; i++) {
//y = 2 * ( i / (nlat-1) ) - 1;
y = 2 * ( i / (nlat-1) ) - 1;
y = y ;
r = Math.sqrt( 1 - y*y ) - 0.1 * (1.0 - frac);
for (j = 0; j < nl; j++) {
phi = 2 * Math.PI * j / nl;
x = -Math.sin(phi)*r;
x = x+1.0*(1.0-frac);
c[nlat*nl + i*nl+j].x = x; // new SFVec3f(x,y,z);
}
}
//}
}"
]
}
ROUTE S.c TO C.set_point
ROUTE S.tc TO TC.set_point
ROUTE S.ci TO IFS.set_coordIndex
DEF time TimeSensor { cycleInterval 40 loop TRUE enabled TRUE }
DEF rotation OrientationInterpolator {
key [ 0 0.25 0.5 0.75 1 ]
keyValue [ 1 1 0 0, 1 1 0 1.57, 1 1 0 3.14
1 1 0 4.71, 1 1 0 0
]
}
ROUTE time.fraction TO rotation.fraction
##ROUTE rotation.value TO object.rotation
ROUTE time.fraction TO S.change
}
Background { skyColor [0.9 .1 .1] }
NavigationInfo { type ["EXAMINE", "ANY"] }
Viewpoint {
position 0 0 10
orientation 0 0 1 0
}
Transform {
translation 0 0 0
scale 2 2 2
children [
Shape {
appearance DEF A Appearance {
material Material {}
##texture ImageTexture { url ["local/images/check.gif"] }
texture ImageTexture { url ["@logo.jpg"] }
}
##geometry asphere { nlatitude 32 nlongitude 20 }
geometry asphere { nlatitude 100 nlongitude 100 }
}
]
}