-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSF6.html
More file actions
178 lines (155 loc) · 5.7 KB
/
Copy pathSF6.html
File metadata and controls
178 lines (155 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<html>
<head>
<title>SF6 MOLECULE</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
<h1 style="text-align: center;">SF6 MOLECULE</h1>
<script src="js/three.js"></script>
<script src="js/OrbitControls.js"></script>
<script src="js/Fog.js"></script>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 100, window.innerWidth/window.innerHeight, 1, 1000 );
camera.position.set( -20, 5, -8 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var control=new THREE.OrbitControls(camera,renderer.domElement);
var ambientLight = new THREE.AmbientLight( 0xffffff);
var light = new THREE.DirectionalLight( 0xeeeeee, 1.0 );
light.position.set( 200, 400, 500 );
var light2 = new THREE.DirectionalLight( 0x222222, 1.0 );
light2.position.set( -400, 200, -300);
scene.add(ambientLight);
scene.add(light);
scene.add(light2);
///sulphur
var material= new THREE.MeshLambertMaterial({color:0x0000ff});
var geo=new THREE.SphereGeometry(5,64,64);
var mesh= new THREE.Mesh(geo,material);
scene.add(mesh);
var l=10
///f1
var material= new THREE.MeshLambertMaterial({color:0x00ff00});
var geo=new THREE.SphereGeometry(2,64,64);
mesh= new THREE.Mesh(geo,material);
mesh.position.x=l ;
mesh.position.y= 0;
mesh.position.z= 0;
scene.add(mesh);
///f2
material= new THREE.MeshLambertMaterial({color:0x00ff00});
geo=new THREE.SphereGeometry(2,64,64);
mesh= new THREE.Mesh(geo,material);
mesh.position.x=-l ;
mesh.position.y= 0;
mesh.position.z= 0;
scene.add(mesh);
///f3
material= new THREE.MeshLambertMaterial({color:0x00ff00});
geo=new THREE.SphereGeometry(2,64,64);
mesh= new THREE.Mesh(geo,material);
mesh.position.x=0 ;
mesh.position.y= l;
mesh.position.z= 0;
scene.add(mesh);
///f4
material= new THREE.MeshLambertMaterial({color:0x00ff00});
geo=new THREE.SphereGeometry(2,64,64);
mesh= new THREE.Mesh(geo,material);
mesh.position.x=0 ;
mesh.position.y= -l;
mesh.position.z= 0;
scene.add(mesh);
///f5
material= new THREE.MeshLambertMaterial({color:0x00ff00});
geo=new THREE.SphereGeometry(2,64,64);
mesh= new THREE.Mesh(geo,material);
mesh.position.x=0 ;
mesh.position.y= 0;
mesh.position.z= l;
scene.add(mesh);
///f6
material= new THREE.MeshLambertMaterial({color:0x00ff00});
geo=new THREE.SphereGeometry(2,64,64);
mesh= new THREE.Mesh(geo,material);
mesh.position.x=0 ;
mesh.position.y= 0;
mesh.position.z= -l;
scene.add(mesh);
///bond1
geo = new THREE.CylinderGeometry( 0.4, 0.4, l, 64 );
material = new THREE.MeshLambertMaterial( {color: 0xFF80FF} );
var mesh1 = new THREE.Mesh( geo, material );
mesh1.position.x=l/2 ;
mesh1.position.y= 0;
mesh1.position.z= 0;
scene.add(mesh1);
///bond2
geo = new THREE.CylinderGeometry( 0.4, 0.4, l, 64 );
material = new THREE.MeshLambertMaterial( {color: 0xFF80FF} );
var mesh2 = new THREE.Mesh( geo, material );
mesh2.position.x=-l/2;
mesh2.position.y= 0;
mesh2.position.z= 0;
scene.add(mesh2);
///bond3
geo = new THREE.CylinderGeometry( 0.4, 0.4, l, 64 );
material = new THREE.MeshLambertMaterial( {color: 0xFF80FF} );
var mesh3 = new THREE.Mesh( geo, material );
mesh3.position.x=0 ;
mesh3.position.y= l/2;
mesh3.position.z= 0;
scene.add(mesh3);
///bond4
geo = new THREE.CylinderGeometry( 0.4, 0.4, l, 64 );
material = new THREE.MeshLambertMaterial( {color: 0xFF80FF} );
var mesh4 = new THREE.Mesh( geo, material );
mesh4.position.x=0 ;
mesh4.position.y= -l/2;
mesh4.position.z= 0;
scene.add(mesh4);
///bond5
geo = new THREE.CylinderGeometry( 0.4, 0.4, l, 64 );
material = new THREE.MeshLambertMaterial( {color: 0xFF80FF} );
var mesh5 = new THREE.Mesh( geo, material );
mesh5.position.x=0 ;
mesh5.position.y= 0;
mesh5.position.z= l/2;
scene.add(mesh5);
///bond6
geo = new THREE.CylinderGeometry( 0.4, 0.4, l, 64 );
material = new THREE.MeshLambertMaterial( {color: 0xFF80FF} );
var mesh6 = new THREE.Mesh( geo, material );
mesh6.position.x=0 ;
mesh6.position.y= 0;
mesh6.position.z= -l/2;
scene.add(mesh6);
var path = 'js/chem/';
var format = '.jpg';
var envMap = new THREE.CubeTextureLoader().load( [
path + 'posx' + format, path + 'negx' + format,
path + 'posy' + format, path + 'negy' + format,
path + 'posz' + format, path + 'negz' + format
] );
scene.background = envMap;
var axesHelper = new THREE.AxesHelper( 20 );
scene.add( axesHelper );
///
var animate = function () {
requestAnimationFrame( animate );
//animate//
mesh1.rotation.z=Math.PI/2;
mesh2.rotation.z=-Math.PI/2;
mesh5.rotation.x=-Math.PI/2;
mesh6.rotation.x=Math.PI/2;
renderer.render( scene, camera );
};
animate();
</script>
</body>
</html>