topical media & game development
mobile-query-three-plugins-rollercoster-examples-index-dev.htm / htm
<!doctype html><title>Minimal tQuery Page</title>
<script src="../../../build/tquery-bundle.js"></script>
<body><script>
var world = tQuery.createWorld().boilerplate().start();
var sampleClosedSpline = new THREE.ClosedSplineCurve3([
new THREE.Vector3(-40, 0, -40),
new THREE.Vector3( 40, 0, -40),
new THREE.Vector3( 40, 0, 40),
new THREE.Vector3(-40, 0, 40),
]);
var geometry = new THREE.TubeGeometry(sampleClosedSpline, 50, 4, 3, false, true);
var mesh = THREE.SceneUtils.createMultiMaterialObject( geometry, [
new THREE.MeshBasicMaterial( { color: 0x8888FF, opacity: 0.9, transparent: true } ),
new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, opacity: 0.3 } )
]);
var scale = 1/40;
tQuery(mesh).scale(scale).addTo(world);
geometry.debug && mesh.add(geometry.debug);
world.removeCameraControls();
world.loop().hook(function(delta, now){
var camera = world.tCamera();
var pct = (now % 4)/4;
var path = geometry.path;
var point = path.getPointAt(pct);
point.multiplyScalar(scale);
camera.position.copy(point);
var point = path.getPointAt((pct+0.01)%1);
point.multiplyScalar(scale);
camera.lookAt(point);
});
</script></body>
(C) Æliens
04/09/2009
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.