Skip to content

Commit 5774fb9

Browse files
committed
1.1.3
1 parent 46cd454 commit 5774fb9

File tree

2 files changed

+35287
-0
lines changed

2 files changed

+35287
-0
lines changed

Chapter1/1.1.3.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2+
<html>
3+
<head>
4+
<script type="text/javascript" src="../lib/three.js"></script>
5+
6+
<script type="text/javascript">
7+
function init() {
8+
var renderer = new THREE.WebGLRenderer({
9+
canvas: document.getElementById('mainCanvas')
10+
});
11+
renderer.setClearColor(0x000000); // black
12+
13+
var scene = new THREE.Scene();
14+
15+
var camera = new THREE.PerspectiveCamera(45, 4 / 3, 1, 1000);
16+
camera.position.set(0, 0, 5);
17+
camera.lookAt(new THREE.Vector3(0, 0, 0));
18+
scene.add(camera);
19+
20+
var cube = new THREE.Mesh(new THREE.CubeGeometry(1, 1, 1),
21+
new THREE.MeshBasicMaterial({
22+
color: 0xffffff // white
23+
}));
24+
scene.add(cube);
25+
26+
renderer.render(scene, camera);
27+
}
28+
</script>
29+
</head>
30+
31+
<body onload="init()">
32+
<canvas id="mainCanvas" width="400px" height="300px" ></canvas>
33+
</body>
34+
</html>

0 commit comments

Comments
 (0)