Browse Source

Cleanup code in css3d_molecules example (#25587)

Nathan Bierema 2 years ago
parent
commit
d2c88a05df
1 changed files with 5 additions and 5 deletions
  1. 5 5
      examples/css3d_molecules.html

+ 5 - 5
examples/css3d_molecules.html

@@ -370,11 +370,7 @@
 
 
 						//
 						//
 
 
-						bond = document.createElement( 'div' );
-						bond.className = 'bond';
-						bond.style.height = bondLength + 'px';
-
-						const joint = new THREE.Object3D( bond );
+						const joint = new THREE.Object3D();
 						joint.position.copy( start );
 						joint.position.copy( start );
 						joint.position.lerp( end, 0.5 );
 						joint.position.lerp( end, 0.5 );
 
 
@@ -384,6 +380,10 @@
 						joint.matrixAutoUpdate = false;
 						joint.matrixAutoUpdate = false;
 						joint.updateMatrix();
 						joint.updateMatrix();
 
 
+						bond = document.createElement( 'div' );
+						bond.className = 'bond';
+						bond.style.height = bondLength + 'px';
+
 						object = new CSS3DObject( bond );
 						object = new CSS3DObject( bond );
 						object.rotation.y = Math.PI / 2;
 						object.rotation.y = Math.PI / 2;