-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.html
80 lines (63 loc) · 1.59 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js assignment 2</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
color: #000;
font-family:Monospace;
font-size:13px;
text-align:center;
background-color: #ffffff;
margin: 0px;
overflow: hidden;
}
#info {
position: absolute;
top: 0px; width: 100%;
padding: 5px;
background-color: white;
}
a {
color: #0080ff;
}
</style>
</head>
<body>
<div id="container"></div>
<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - assignment 2 - webgl</div>
<script src="three.min.js"></script>
<script src="helperFns.js"></script>
<script>
var container, stats;
var views, scene, renderer;
var windowWidth, windowHeight;
view =
{
left: 0,
top: 0,
width: 1,
height: 1,
near:0.1,
far:500,
background: new THREE.Color( 0, 0, 0 ),
eye: [ 70, 0, 10],
up: [ 0, 0, 1 ],
fov: 60,
length: 35,
theta0: 70,
x0:90,
z0:40,
updateCamera: function ( camera, scene, bulb ) {
p = 0.5 - 0.5 * Math.cos(4*Math.PI*t/(60*T))
let bulbPosition = new THREE.Vector3(light.position.x,light.position.y,light.position.z);
let initialLookAt = new THREE.Vector3(scene.position.x,scene.position.y,scene.position.z+20)
camera.lookAt( bulbPosition.multiplyScalar(p).addScaledVector(initialLookAt,1-p))
}
}
init();
</script>
</body>
</html>