-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp1.html
53 lines (43 loc) · 1.24 KB
/
app1.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
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="author" content="Olivier BOES">
<title>Rotating Cube</title>
<style>
body {
font-family: Monospace;
background-color: #000000;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script src="./Three.js"></script>
<script src="./TrackballControls.js"></script>
<script>
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.01, 1000 );
camera.position.set( 0, 0, 10 );
var controls = new THREE.TrackballControls( camera );
var scene = new THREE.Scene();
var cube = new THREE.Mesh(
new THREE.CubeGeometry( 1, 1, 1 ),
new THREE.MeshBasicMaterial( { wireframe: true } )
);
scene.add( cube );
scene.add( new THREE.AxisHelper() );
function animate() {
requestAnimationFrame( animate );
controls.update();
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render( scene, camera );
};
animate();
</script>
</body>
</html>