Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions examples/css2d_label.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

<script>

var camera, scene, scene2, renderer, labelRenderer;
var controls;
var camera, scene, renderer, labelRenderer;

var clock = new THREE.Clock();
var textureLoader = new THREE.TextureLoader();

Expand All @@ -64,12 +64,10 @@
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.set( 10, 5, 20 );

controls = new THREE.OrbitControls( camera );
var controls = new THREE.OrbitControls( camera );

scene = new THREE.Scene();

scene2 = new THREE.Scene();

var dirLight = new THREE.DirectionalLight( 0xffffff );
dirLight.position.set( 0, 0, 1 );
scene.add( dirLight );
Expand Down
41 changes: 31 additions & 10 deletions examples/css3d_molecules.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@

function generateButtonCallback( url ) {

return function ( event ) {
return function () {

loadMolecule( url );

}
};

}

Expand All @@ -196,7 +196,7 @@
button.innerHTML = m;
menu.appendChild( button );

var url = "models/molecules/" + MOLECULES[ m ];
var url = "models/molecules/" + MOLECULES[ m ];

button.addEventListener( 'click', generateButtonCallback( url ), false );

Expand All @@ -206,9 +206,24 @@
var b_b = document.getElementById( "b_b" );
var b_ab = document.getElementById( "b_ab" );

b_a.addEventListener( 'click', function() { visualizationType = 0; showAtoms() } );
b_b.addEventListener( 'click', function() { visualizationType = 1; showBonds() } );
b_ab.addEventListener( 'click', function() { visualizationType = 2; showAtomsBonds() } );
b_a.addEventListener( 'click', function () {

visualizationType = 0;
showAtoms();

} );
b_b.addEventListener( 'click', function () {

visualizationType = 1;
showBonds();

} );
b_ab.addEventListener( 'click', function () {

visualizationType = 2;
showAtomsBonds();

} );

}

Expand Down Expand Up @@ -458,7 +473,7 @@
joint.updateMatrix();

var object = new THREE.CSS3DObject( bond );
object.rotation.y = Math.PI/2;
object.rotation.y = Math.PI / 2;

object.matrixAutoUpdate = false;
object.updateMatrix();
Expand All @@ -479,9 +494,15 @@

switch ( visualizationType ) {

case 0: showAtoms(); break;
case 1: showBonds(); break;
case 2: showAtomsBonds(); break;
case 0:
showAtoms();
break;
case 1:
showBonds();
break;
case 2:
showAtomsBonds();
break;

}

Expand Down
4 changes: 1 addition & 3 deletions examples/css3d_orthographic.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

var scene2, renderer2;

var controls;

init();
animate();

Expand All @@ -55,7 +53,7 @@

camera.position.set( - 200, 200, 200 );

controls = new THREE.OrbitControls( camera );
var controls = new THREE.OrbitControls( camera );

scene = new THREE.Scene();
scene.background = new THREE.Color( 0xf0f0f0 );
Expand Down
17 changes: 8 additions & 9 deletions examples/css3d_panorama.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<script>

var camera, scene, renderer;
var geometry, material, mesh;
var target = new THREE.Vector3();

var lon = 90, lat = 0;
Expand All @@ -58,32 +57,32 @@
var sides = [
{
url: 'textures/cube/Bridge2/posx.jpg',
position: [ -512, 0, 0 ],
position: [ - 512, 0, 0 ],
rotation: [ 0, Math.PI / 2, 0 ]
},
{
url: 'textures/cube/Bridge2/negx.jpg',
position: [ 512, 0, 0 ],
rotation: [ 0, -Math.PI / 2, 0 ]
rotation: [ 0, - Math.PI / 2, 0 ]
},
{
url: 'textures/cube/Bridge2/posy.jpg',
position: [ 0, 512, 0 ],
position: [ 0, 512, 0 ],
rotation: [ Math.PI / 2, 0, Math.PI ]
},
{
url: 'textures/cube/Bridge2/negy.jpg',
position: [ 0, -512, 0 ],
position: [ 0, - 512, 0 ],
rotation: [ - Math.PI / 2, 0, Math.PI ]
},
{
url: 'textures/cube/Bridge2/posz.jpg',
position: [ 0, 0, 512 ],
position: [ 0, 0, 512 ],
rotation: [ 0, Math.PI, 0 ]
},
{
url: 'textures/cube/Bridge2/negz.jpg',
position: [ 0, 0, -512 ],
position: [ 0, 0, - 512 ],
rotation: [ 0, 0, 0 ]
}
];
Expand Down Expand Up @@ -147,7 +146,7 @@

}

function onDocumentMouseUp( event ) {
function onDocumentMouseUp() {

document.removeEventListener( 'mousemove', onDocumentMouseMove );
document.removeEventListener( 'mouseup', onDocumentMouseUp );
Expand Down Expand Up @@ -193,7 +192,7 @@

requestAnimationFrame( animate );

lon += 0.1;
lon += 0.1;
lat = Math.max( - 85, Math.min( 85, lat ) );
phi = THREE.Math.degToRad( 90 - lat );
theta = THREE.Math.degToRad( lon );
Expand Down
13 changes: 6 additions & 7 deletions examples/css3d_panorama_deviceorientation.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

var camera, scene, renderer;
var controls;
var geometry, material, mesh;

init();
animate();
Expand All @@ -56,32 +55,32 @@
var sides = [
{
url: 'textures/cube/Bridge2/posx.jpg',
position: [ -512, 0, 0 ],
position: [ - 512, 0, 0 ],
rotation: [ 0, Math.PI / 2, 0 ]
},
{
url: 'textures/cube/Bridge2/negx.jpg',
position: [ 512, 0, 0 ],
rotation: [ 0, -Math.PI / 2, 0 ]
rotation: [ 0, - Math.PI / 2, 0 ]
},
{
url: 'textures/cube/Bridge2/posy.jpg',
position: [ 0, 512, 0 ],
position: [ 0, 512, 0 ],
rotation: [ Math.PI / 2, 0, Math.PI ]
},
{
url: 'textures/cube/Bridge2/negy.jpg',
position: [ 0, -512, 0 ],
position: [ 0, - 512, 0 ],
rotation: [ - Math.PI / 2, 0, Math.PI ]
},
{
url: 'textures/cube/Bridge2/posz.jpg',
position: [ 0, 0, 512 ],
position: [ 0, 0, 512 ],
rotation: [ 0, Math.PI, 0 ]
},
{
url: 'textures/cube/Bridge2/negz.jpg',
position: [ 0, 0, -512 ],
position: [ 0, 0, - 512 ],
rotation: [ 0, 0, 0 ]
}
];
Expand Down
12 changes: 6 additions & 6 deletions examples/css3d_periodictable.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@

var number = document.createElement( 'div' );
number.className = 'number';
number.textContent = (i/5) + 1;
number.textContent = ( i / 5 ) + 1;
element.appendChild( number );

var symbol = document.createElement( 'div' );
Expand Down Expand Up @@ -299,7 +299,7 @@

for ( var i = 0, l = objects.length; i < l; i ++ ) {

var phi = Math.acos( -1 + ( 2 * i ) / l );
var phi = Math.acos( - 1 + ( 2 * i ) / l );
var theta = Math.sqrt( l * Math.PI ) * phi;

var object = new THREE.Object3D();
Expand Down Expand Up @@ -366,28 +366,28 @@
controls.addEventListener( 'change', render );

var button = document.getElementById( 'table' );
button.addEventListener( 'click', function ( event ) {
button.addEventListener( 'click', function () {

transform( targets.table, 2000 );

}, false );

var button = document.getElementById( 'sphere' );
button.addEventListener( 'click', function ( event ) {
button.addEventListener( 'click', function () {

transform( targets.sphere, 2000 );

}, false );

var button = document.getElementById( 'helix' );
button.addEventListener( 'click', function ( event ) {
button.addEventListener( 'click', function () {

transform( targets.helix, 2000 );

}, false );

var button = document.getElementById( 'grid' );
button.addEventListener( 'click', function ( event ) {
button.addEventListener( 'click', function () {

transform( targets.grid, 2000 );

Expand Down
4 changes: 2 additions & 2 deletions examples/css3d_sprites.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
scene = new THREE.Scene();

var image = document.createElement( 'img' );
image.addEventListener( 'load', function ( event ) {
image.addEventListener( 'load', function () {

for ( var i = 0; i < particlesTotal; i ++ ) {

Expand Down Expand Up @@ -135,7 +135,7 @@

for ( var i = 0; i < particlesTotal; i ++ ) {

var phi = Math.acos( -1 + ( 2 * i ) / particlesTotal );
var phi = Math.acos( - 1 + ( 2 * i ) / particlesTotal );
var theta = Math.sqrt( particlesTotal * Math.PI ) * phi;

positions.push(
Expand Down
13 changes: 10 additions & 3 deletions examples/css3d_youtube.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
}
#blocker {
position: absolute;
/* background-color: rgba(255, 0, 0, 0.5); */
top: 0px;
left: 0px;
width: 100%;
Expand Down Expand Up @@ -87,8 +86,16 @@
var blocker = document.getElementById( 'blocker' );
blocker.style.display = 'none';

document.addEventListener( 'mousedown', function () { blocker.style.display = ''; } );
document.addEventListener( 'mouseup', function () { blocker.style.display = 'none'; } );
document.addEventListener( 'mousedown', function () {

blocker.style.display = '';

} );
document.addEventListener( 'mouseup', function () {

blocker.style.display = 'none';

} );

}

Expand Down
13 changes: 6 additions & 7 deletions examples/raytracing_sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

var container, info;

var camera, controls, scene, renderer;
var camera, scene, renderer;
var group;

init();
Expand Down Expand Up @@ -266,7 +266,7 @@
container.appendChild( renderer.domElement );


window.addEventListener( 'resize', function( e ) {
window.addEventListener( 'resize', function () {

renderer.setSize( innerWidth, innerHeight );

Expand All @@ -283,24 +283,23 @@

}

info.innerHTML = '<a href="http://threejs.org" target="_blank" rel="noopener">three.js<a/> - raytracing renderer (using ' + WORKERS + ' <button onclick="updateWorkers(-1)">-</button><button onclick="updateWorkers(1)">+</button> web workers)' +
info.innerHTML = '<a href="http://threejs.org" target="_blank" rel="noopener">three.js<a/> - raytracing renderer (using ' + WORKERS + ' <button onclick="updateWorkers(-1)">-</button><button onclick="updateWorkers(1)">+</button> web workers)' +
'<br/><button onclick="rearrange()">Rearrange</button><button onclick="render()">Render</button>';


}

function rearrange() {

group.children.forEach( function( o ) {
group.children.forEach( function ( o ) {

o.position.y += ( Math.random() - 0.5 ) * 100;
o.position.y += ( Math.random() - 0.5 ) * 100;
o.position.x += ( Math.random() - 0.5 ) * 400;
o.position.z += ( Math.random() - 0.5 ) * 400;

} );

}

}

function render() {

Expand Down
Loading