-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
61 lines (59 loc) · 1.78 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
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel='stylesheet' type='text/css' href='' />
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<style>
body {
font-family:monospace;
width: 600px;
margin: 0 auto;
background:#111;
}
pre {
color:#fdd;
font-size:40px;
line-height:50px;
text-align:right;
}
button {
background:#fdd;
color:#000;
padding:10px;
border:0;
}
a {
color:#fdd;
border:1px solid #fdd;
padding:10px;
display:inline-block;
}
</style>
</head>
<body>
<pre id='date'></pre>
<pre id='time'></pre>
<button id='rand'>to random</button>
<a href='https://github.com/tmcw/date-tween'>(date-tween on github)</a>
<script src='index.js'></script>
<script>
var datediv = document.getElementById('date');
var timediv = document.getElementById('time');
var start = new Date('January 1, 2010');
var end = new Date('March 1, 2010');
dateTween(start, end, 2000, function(d) {
datediv.innerHTML = dateTweenFormatDate(d);
time.innerHTML = dateTweenFormatTime(d);
});
document.getElementById('rand').onclick = function() {
dateTween(end, new Date(+end + ((Math.random() - 0.5) * 10000000000)), 2000, function(d) {
datediv.innerHTML = dateTweenFormatDate(d);
time.innerHTML = dateTweenFormatTime(d);
}, function(d) {
end = d;
});
}
</script>
</body>
</html>