-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrig.html
53 lines (31 loc) · 857 Bytes
/
trig.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
<html>
<head>
<title>trig</title>
<body>
<div id='display'>
</div>
<script type='text/javascript'>
angle = 110;
distance = 250;
if (angle != 0) {
angle = Math.PI * (angle / 180);
} else {
angle = 0;
}
for (i=0; i<=distance; i++) {
xoffset = Math.cos(angle) * i;
yoffset = Math.sqrt((i * i) - (xoffset * xoffset));
newLocation = document.createElement('img');
newLocation.setAttribute('id', 'dot' + i);
newLocation.setAttribute('src', 'dot.gif');
document.getElementById('display').appendChild(newLocation);
currentLocation = document.getElementById('dot' + i);
currentLocation.style.top = Math.round(100 - xoffset);
currentLocation.style.left = Math.round(100 + yoffset);
currentLocation.style.position = 'absolute';
currentLocation.height = 2;
currentLocation.width = 2;
}
</script>
</body>
</html>