-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex9.html
79 lines (58 loc) · 2.24 KB
/
index9.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
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<p style="text-align: center">Place the red circle on the
<strong>most</strong> uncertain object on the map, then press enter.</p>
<div id='js-geojson-example'></div>
<script src="js/jquery.js"></script>
<script src="js/d3.js"></script>
<script src="js/common.js"></script>
<script src="js/js.cookie.js"></script>
<link rel="stylesheet" href="css/style.css" />
<script>
$(document).ready(function() {
$('body').keypress(function(e) {
if (e.keyCode == 13) {
window.location.href = "index10_intro.html";
}
});
});
d3.json("Data/car.json", function(carjson) {
var cardata = randomize(carjson);
$.post("server.py", {
session: Cookies.get('session'),
data: JSON.stringify(cardata),
page: "9"
}, function(data) {
console.log("file written");
});
var selection = car.selectAll('path')
.data(cardata.features)
.enter()
.append('svg:circle')
.attr("transform", function(d) {
return "translate(" + projection(d.geometry.coordinates) + ")";
})
repeat();
function repeat() {
var transitionDur = 200;
selection.attr('r', function(d) {
return radius(d.properties.accuracy);
})
.transition()
.duration(transitionDur)
.ease("quad")
.attr("transform", function(d) {
var angle = Math.random() * Math.PI * 2;
x = Math.cos(angle) * d.properties.accuracy;
y = Math.sin(angle) * d.properties.accuracy;
prj = projection(d.geometry.coordinates);
prj[0] = prj[0] + x * 3;
prj[1] = prj[1] + y * 3;
return "translate(" + prj + ")";
})
.each("end", repeat);
}
});
</script>
</body>