This repository has been archived by the owner on Jan 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.html
307 lines (265 loc) · 11.2 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="author" content="Fengz" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDVwtjIUmIdX-GInth2K3C0D59PZ2Qoz3Q&sensor=false"></script>
</head>
<body>
<button id="start_btn" class="btn btn-primary btn-large centered">START</button>
<div id="map_canvas" style="width:100%; height:100%;"></div>
<div id="curtain"></div>
<div id="end_text" class="centered" style="margin-left: -250px">
<center>
<canvas id="heart" width="400" height="400"></canvas>
</center>
<p>Happy Valentine's Day,My Christy.</p><p style="text-align:center;">I Love You.</p></div>
<audio preload="auto" id="music">
<source src="music.mp3" type="audio/mpeg" />
</audio>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/screenfull.min.js"></script>
<script type="text/javascript">
!function(){
$("#start_btn").click(function(){
screenfull && screenfull.request();
$(this).remove();
init();
});
var map, marker_me, marker_you;
var HUIZHOU = new google.maps.LatLng(23.041865,114.57435),
GZ = new google.maps.LatLng(23.359513,113.375203);
var DEFAULT_CENTER = new google.maps.LatLng(29.075375, 60.46875),
HEART_ISLAND = new google.maps.LatLng(43.978549,15.383574);
function smoothZoom(dest_zoom, callback){
callback = callback || function(){};
var now_zoom = map.getZoom();
if(now_zoom == dest_zoom){
callback();
}
var increm = now_zoom < dest_zoom ? 1:-1;
var timeout = setInterval(function(){
now_zoom += increm;
map.setZoom(now_zoom);
if(now_zoom == dest_zoom){
clearTimeout(timeout);
setTimeout(function(){
callback();
}, 700);
}
}, 800);
}
function loopInfoWindows(infowindows, interval, callback, keep_last){
var i = 0, len = infowindows.length;
var timeout = setInterval(function(){
i > 0 && infowindows[i-1].close();
infowindows[i].open(map);
if(++i == len){
clearInterval(timeout);
!keep_last && infowindows[i-1].close();
(callback || function(){})();
}
}, interval || 1000);
}
window.theEnd = function(){
marker_you.setAnimation(google.maps.Animation.BOUNCE);
setTimeout(function(){
$("#curtain").animate({
height: $(window).height()
}, 6000, function(){
$("#end_text").fadeIn("slow",function(){drawHeart();});
});
}, 3000);
}
function showILoveYous(){
var i_love_you_s = [
{ point: "52.9, -0.5", text: "I Love You" },
{ point: "52.6, 10.9", text: "Ich liebe Dich" },
{ point: "53.3, 20.7", text: "Kocham Cię" },
{ point: "48.8, 5.1", text: "Je t'aime" },
{ point: "39.8, -8.9", text: "Eu te amo" },
{ point: "39.6, -3.3", text: "Te amo" },
{ point: "42.9, 13.9", text: "Ti amo" },
{ point: "61.5, 88.6", text: "Я люблю тебя" },
{ point: "36.6, 138.9", text: "私はあなたを愛して" },
{ point: "36.9, 127.6", text: "난 널 사랑해" },
{ point: "30.6, 114.3", text: "我爱你" },
{ point: "30.6, 114.3", text: "我爱你" }
];
var infowindows = [];
$.each(i_love_you_s, function(i, i_love_you){
var point = i_love_you.point.split(",");
var infowindow = new google.maps.InfoWindow({
content: "<b>" + i_love_you.text + "</b>",
position: new google.maps.LatLng(point[0], point[1])
});
infowindows.push(infowindow);
});
loopInfoWindows(infowindows, 2000, function(){
map.panTo(DEFAULT_CENTER);
setTimeout(function(){
theEnd();
}, 1000);
});
}
function showPhotos(){
var PHOTO_BASE = "photos/";
var photos = [
{ point: "43.97855, 15.38354", src: PHOTO_BASE + "1.jpeg" },
{ point: "43.97844, 15.38459", src: PHOTO_BASE + "2.jpeg" },
{ point: "43.97847, 15.38215", src: PHOTO_BASE + "3.jpeg" },
{ point: "43.97907, 15.38198", src: PHOTO_BASE + "4.jpeg" },
{ point: "43.97957, 15.38472", src: PHOTO_BASE + "5.jpeg" },
{ point: "43.98028, 15.38552", src: PHOTO_BASE + "6.jpeg" },
{ point: "43.97932, 15.38112", src: PHOTO_BASE + "7.jpeg" },
{ point: "43.97694, 15.38354", src: PHOTO_BASE + "8.jpeg" },
{ point: "43.97819, 15.38485", src: PHOTO_BASE + "9.jpeg" },
{ point: "43.97861, 15.38178", src: PHOTO_BASE + "10.jpeg" },
{ point: "43.97788, 15.38363", src: PHOTO_BASE + "11.jpeg" },
{ point: "43.97836, 15.38496", src: PHOTO_BASE + "12.jpeg" },
{ point: "43.97952, 15.38545", src: PHOTO_BASE + "13.jpeg" }
];
var infowindows = [];
$.each(photos, function(i, photo){
var point = photo.point.split(",");
var infowindow = new google.maps.InfoWindow({
content: "<img src='" + photo.src + "' style='width:400px;height:300px;' />",
position: new google.maps.LatLng(point[0], point[1])
});
infowindows.push(infowindow);
});
loopInfoWindows(infowindows, 2000, function(){
map.panTo(HEART_ISLAND);
smoothZoom(3, function(){
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
map.panTo(DEFAULT_CENTER);
showILoveYous();
});
});
}
function showHeartIsland(){
map.panTo(DEFAULT_CENTER);
map.panTo(HEART_ISLAND);
smoothZoom(16, function(){
map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
setTimeout(function(){showPhotos()}, 5000);
});
}
function init() {
// play the background music
var music = document.getElementById("music");
music.play();
map = new google.maps.Map(document.getElementById("map_canvas"), {
center: new google.maps.LatLng(23.342256,113.905838),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
marker_me = new google.maps.Marker({
position: HUIZHOU,
title: "me",
icon: "http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png",
animation: google.maps.Animation.DROP,
map: map
});
marker_you = new google.maps.Marker({
position: GZ,
title: "you",
icon: "http://maps.gstatic.com/mapfiles/ms2/micons/red-dot.png",
animation: google.maps.Animation.DROP,
map: map
});
marker_me.setAnimation(google.maps.Animation.BOUNCE);
setTimeout(function(){
showHeartIsland();
}, 8000);
}
}();
</script>
<script type="text/javascript" src="js/PxLoader.js"></script>
<script type="text/javascript" src="js/PxLoaderImage.js"></script>
<script type="text/javascript">
var preloader = new PxLoader();
for(var i = 1; i <= 13; i++){
preloader.add( new PxLoaderImage("photos/" +i + ".jpeg"), "you" );
}
preloader.start(["you"]);
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
// set your gogle analytics account below
_gaq.push(['_setAccount', '']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
var canvas;
var ctx;
var rx = 200;
var ry = 200;
var radius = 180;
var sleep = 0;
var count = 0;
function deg2rad(x)
{
return x *Math.PI/180;
}
function drawCircle(x, y, r)
{
ctx.beginPath();
ctx.arc(x,y,r,0,Math.PI*2,true);
ctx.stroke();
}
function drawLine(x1, y1, x2, y2)
{
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
if (count++ == 82) {
count = 0;
document.getElementById('redraw').disabled = false;
sleep = 0;
}
}
function drawSide(begin1, end1, step1, begin2, step2)
{
var d1, d2, x1, y1, x2, y2;
while (begin1 != end1+step1) {
d1 = deg2rad(begin1);
d2 = deg2rad(begin2);
x1 = rx + radius * Math.cos(d1);
y1 = ry - radius * Math.sin(d1);
x2 = rx + radius * Math.cos(d2);
y2 = ry - radius * Math.sin(d2);
setTimeout('drawLine(' + x1 + ',' + y1 + ',' + x2 + ',' + y2 + ')', sleep*100);
sleep++;
begin1 += step1;
begin2 += step2;
}
}
function drawHeart()
{
// document.getElementById('redraw').disabled = true;
ctx.clearRect(0,0, canvas.width, canvas.height);
ctx.strokeStyle = "black";
drawCircle(rx, ry, radius, ctx);
ctx.strokeStyle = "red";
drawSide(-90, 0, 4.5, 0, 4.5);
drawSide(-90, -180, -4.5, -180, -4.5);
drawSide(0, 180, 4.5, 90, 9);
callback();
}
(function() {
canvas = document.getElementById('heart');
ctx = canvas.getContext('2d');
})();
</script>
</body>
</html>