-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexperiment1.html
More file actions
59 lines (47 loc) · 1.24 KB
/
experiment1.html
File metadata and controls
59 lines (47 loc) · 1.24 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
<html>
<head>
<title>My first three.js app</title>
<style>
body {
margin: 0;
}
canvas {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<script src="js/three.js"></script>
<script src="js/OrbitControls.js"></script>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
2000
);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var animate = function() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
};
animate();
// adding controls
controls = new THREE.OrbitControls(camera, renderer.domElement);
// adding a simple cube
var geometry = new THREE.BoxGeometry(10, 10, 10);
var material = new THREE.MeshBasicMaterial({
color: 0xffffff,
wireframe: false
});
var cube = new THREE.Mesh(geometry, material);
scene.add(cube);
// move back camera
camera.position.z = 15;
</script>
</body>
</html>