-
Notifications
You must be signed in to change notification settings - Fork 0
/
3.html
47 lines (41 loc) · 1.26 KB
/
3.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
<!DOCTYPE html>
<html>
<head>
<style>
.container{
width: 638px;
height: 1134px;
background-image: url("3.jpg");
background-size: cover;
}
#canvas {
/*position:absolute;*/
}
</style>
</head>
<body>
<div class="container">
<canvas id="canvas" width="580px" height="1270px"></canvas>
</div>
<script src="simpleheat.js"></script>
<script>
var data = [[94.0, 563.0, 3521.9], [576.0, 560.0, 67.95], [272.0, 652.0, 872.1], [262.0, 798.0, 292.14], [264.0, 940.0, 277.41], [61.0, 127.0, 6229.24], [577.0, 135.0, 1948.63], [288.0, 232.0, 3879.07], [273.0, 387.0, 1468.81]];
var heat = simpleheat('canvas').data(data).max(6229.24);
heat.radius(30, 35);
heat.draw();
function getClickPosition(e) {
// var parentPosition = getPosition(e.currentTarget);
var xPosition = e.layerX;// - parentPosition.x;
var yPosition = e.layerY;///2 - parentPosition.y;
heat.add([xPosition, yPosition, 1]);
heat.draw();
console.info({
el: e,
"x": xPosition,
"y": yPosition
});
};
document.getElementById("canvas").addEventListener("click", getClickPosition, false);
</script>
</body>
</html>