-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
52 lines (45 loc) · 1.43 KB
/
index.html
File metadata and controls
52 lines (45 loc) · 1.43 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
<html>
<body>
<script src="http://gamingJS.com/Three.js"></script>
<script src="http://gamingJS.com/ChromeFixes.js"></script>
<script>
// This is where stuff in our game will happen:
var scene = new THREE.Scene();
// This is what sees the stuff:
var aspect_ratio = window.innerWidth / window.innerHeight;
var camera = new THREE.PerspectiveCamera(75, aspect_ratio, 1, 10000);
camera.position.z = 500;
scene.add(camera);
// This will draw what the camera sees onto the screen:
var renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// ******** START CODING ON THE NEXT LINE ********
var shape = new THREE.CubeGeometry(100,100,100)
var cover = new THREE.MeshNormalMaterial()
var box = new THREE.Mesh(shape,cover)
scene.add(box)
box.rotation.set(0.5,0.5,0.5)
t=THREE
ball=new t.Mesh(new t.SphereGeometry(100,20,15), cover)
scene.add(ball)
ball.position.set(200,0,0)
var clock = new t.Clock()
function animate() {
requestAnimationFrame(animate)
var time =clock.getElapsedTime()
ball.rotation.set(time,time,0)
box.rotation.set(time,time,0)
henger.rotation.set(time,time,0)
renderer.render(scene,camera)
}
henger=new t.Mesh(new t.CylinderGeometry(20,20,100), cover)
henger.position.set(-200,0,0)
scene.add(henger)
animate()
</script>
<.body>
</html>
// Now, show what the camera sees on the screen:
renderer.render(scene, camera);
</script>