-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
186 lines (168 loc) · 5.92 KB
/
index.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>MUX Lab</title>
<link rel="shortcut icon" href="assets/img/favicon.ico">
<link rel="stylesheet" href="//cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<style>
html, body, #map {
height: 99%;
font-family: "Avenir LT W01 35 Light", "Century Gothic", Helvetica, Arial, sans-serif;
}
#title {
position: absolute;
z-index: 999;
top:40%;
left:50%;
width:100%;
margin:-1.5em 0 0 -50%;
color: #333;
text-align: center;
}
.btn {
border: 0;
color: #fff;
background-color: #20b2aa;
font-weight: 700;
margin: 5px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
background-image: none;
}
.btn-github {
background-color: #20b2aa;
}
.btn-github:hover {
background-color: #42ddd4;
}
.btn-twitter {
background-color: #55acee;
}
.btn-twitter:hover {
background-color: #55d2ee;
}
.leaflet-container {
background: rgba(0,0,0,0);
}
svg.leaflet-zoom-animated > g > path.japan-line {
/* CSS3 Transition to fade-in highlight style */
transition-property: fill, fill-opacity, stroke, stroke-opacity, stroke-width;
transition-duration: 0.4s;
/* for a border line generation */
stroke-dashoffset: 700;
stroke-dasharray: 700;
stroke-linecap: round;
}
svg.leaflet-zoom-animated > g > path.world-line {
/* CSS3 Transition to fade-in highlight style */
transition-property: fill, fill-opacity, stroke, stroke-opacity, stroke-width;
transition-duration: 0.4s;
/* for a border line generation */
stroke-dashoffset: 2500;
stroke-dasharray: 2500;
stroke-linecap: round;
opacity: 0;
}
</style>
</head>
<body>
<div id="title">
<h1>MUX Lab</h1>
<p><b>MUX</b> = <b>M</b>ap <b>U</b>ser <b>Ex</b>perience</p>
<p>We think about <b>UI/UX</b> of interactive maps.</p>
<button class="btn btn-github" onClick="showGitHub()">GitHub</button>
<button class="btn btn-twitter" onClick="showTwitter()">Twitter</button>
</div>
<div id="map"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script>
$(function() {
console.log('%c⚛ muxlab.github.io: Hello geohacker! ⚛', 'font-family:monospace;font-size:16px;color:darkblue;');
var map, japan, world;
function initMap() {
map = L.map('map', { zoomControl: false, maxZoom: 5 }).setView([36, 139], 5);
var defaultStyleWorld = {
className: 'world-line',
color: '#2262CC',
weight: 1,
opacity: 0.6,
fillOpacity: 0
}
$.getJSON('data/world.geojson', function(data) {
world = L.geoJson(data, {
onEachFeature: function (feature, layer) {
layer.setStyle(defaultStyleWorld);
if(feature.properties['name'] === 'Japan') {
layer.setStyle({ opacity: 0 });
}
}
});
world.addTo(map);
});
var defaultStyle = {
className: 'japan-line',
color: '#ff6500',
weight: 1,
opacity: 0.6,
fillOpacity: 0
}
var highlightStyle = {
color: '#ff6500',
weight: 4,
opacity: 0.6,
fillOpacity: 0.65,
fillColor: '#ff6500'
};
$.getJSON('data/japan.geojson', function(data) {
japan = L.geoJson(data, {
onEachFeature: function (feature, layer) {
layer.setStyle(defaultStyle);
(function(layer, properties) {
layer.on('mouseover', function (e) {
console.log('mouseover!');
layer.setStyle(highlightStyle);
});
layer.on('mouseout', function (e) {
layer.setStyle(defaultStyle);
});
})(layer, feature.properties);
}
});
map.fitBounds(japan.getBounds());
japan.addTo(map);
var japanPath = d3.selectAll('.leaflet-zoom-animated').selectAll('g').selectAll('path.japan-line');
var worldPath = d3.selectAll('.leaflet-zoom-animated').selectAll('g').selectAll('path.world-line');
setTimeout(function() {
map.fitBounds(world.getBounds());
worldPath.transition().style({ 'opacity': 0.8 });
worldPath.transition().delay(300).duration(14000).style({ 'stroke-dashoffset': 0 });
}, 5800);
setTimeout(function() {
japanPath.style({ 'stroke-dasharray': 0 });
worldPath.style({ 'stroke-dasharray': 0 });
}, 19800);
japanPath.transition().delay(300).duration(7000).style('stroke-dashoffset', 0);
});
}
initMap();
});
</script>
<script>
function showGitHub() {
location.href = 'https://github.com/muxlab';
}
function showTwitter() {
location.href = 'https://twitter.com/_muxlab';
}
</script>
</body>
</html>