-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (41 loc) · 1.11 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Spinning Sphere in three.js</title>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r76/three.min.js"></script>
<script>
var camera, scene, renderer;
var geometry, material, mesh;
var init = function() {
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( "rgb(255, 255, 255)");
document.body.appendChild( renderer.domElement );
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 2000 );
camera.position.set(0,0,800);
geometry = new THREE.SphereGeometry( 300, 15, 10 );
material = new THREE.MeshNormalMaterial({
wireframe: true,
wireframeLinewidth: 2 });
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
}
var animate = function() {
requestAnimationFrame( animate );
mesh.rotation.y += 0.015;
renderer.render( scene, camera );
}
init();
animate();
</script>
</body>
</html>