-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
225 lines (205 loc) · 9.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
<!doctype html>
<html>
<head>
<meta name="author" content="CSV Soundsystem">
<style>
* {
margin: 0;
padding: 0;
font-family: monospace;
font-weight: normal;
}
#plot {
width: 100%;
}
#canvas {
left: 0;
}
#day, #csv, #sticker, #audio {
position: absolute;
right: 0;
}
#audio {
top: 0;
}
#sticker {
top: 30px;
}
#day {
text-align: right;
top: 140px;
background-color: #000;
padding: 0.5em;
}
#csv {
text-align: left;
bottom: 0;
width: 100%;
background-color: #222;
color: #FFF;
padding-bottom: 1em;
}
#csv * {
display: inline;
}
a, a:visited, a:hover {
color: inherit;
text-decoration: inherit;
}
a {
text-decoration: underline;
}
title, h1 {
color: inherit;
font-size: inherit;
font-weight: bold;
line-height: inherit;
}
strong {
font-size: 4em;
line-height: 0em;
}
.legend-monday, .monday .fg { color: #00DDDD; }
.legend-tuesday, .tuesday .fg { color: #DDDD00; }
.legend-wednesday, .wednesday .fg { color: #DD00DD; }
.legend-thursday, .thursday .fg { color: #DD0000; }
.legend-friday, .friday .fg { color: #00DD00; }
.monday { background-color: #FFDDDD; }
.tuesday { background-color: #DDFFDD; }
.wednesday { background-color: #DDDDFF; }
.thursday { background-color: #DDFFFF; }
.friday { background-color: #FFFFDD; }
.monday .legend-monday { border-bottom: 1px solid #FFDDDD; }
.tuesday .legend-tuesday { border-bottom: 1px solid #DDFFDD; }
.wednesday .legend-wednesday { border-bottom: 1px solid #DDDDFF; }
.thursday .legend-thursday { border-bottom: 1px solid #DDFFFF; }
.friday .legend-friday { border-bottom: 1px solid #FFFFDD; }
</style>
</head>
<body>
<canvas id="canvas" width=1200" height="600"></canvas>
<div id="content">
<div id="csv">
<!-- This is a CSV -->
<title>FMS Symphony</title> <strong>,</strong>by <a rel="author" target="_blank" href="http://csvsoundsystem.com">csv soundsystem</a>
<p>
<strong>,</strong>Chords are daily movements (high/major = $$$ in, low/minor = $$$ out)
<strong>,</strong>Flourishes represent movements up and down (respectively) within a two month rolling window that are beyond 2.5 standard deviations from the mean
<strong>,</strong>The left channel is distance to debt ceiling (higher notes = closer to the debt ceiling) and the right channel is interest rate
<strong>,</strong>Chernoff faces mutate according to 15 principal components of 52 different categories of daily reciepts
<strong>,</strong><span class="legend-monday">Monday</span>
<span class="legend-tuesday">Tuesday</span>
<span class="legend-wednesday">Wednesday</span>
<span class="legend-thursday">Thursday</span>
<span class="legend-friday">Friday</span>
<strong>,</strong><a target="_blank" href=",">Plot more</a>
<strong>,</strong><a target="_blank" href="https://github.com/csvsoundsystem/fms-symphony.git">Edit</a>
<strong>,</strong><a target="_blank" href="fms_symphony.mp3">Download</a>
<strong>,</strong><a id="financial-crisis" href="#777">Financial crisis</a>
<strong>,</strong><a target="_blank" href="http://www.bdatafest.computationalreporting.com/projects/fms-symphony">Huh?</a>
</p>
</div>
<a rel="author" target="_blank" href="http://csvsoundsystem.com">
<img id="sticker" src="csvsoundsytem.png" alt="csv soundsystem">
</a>
<div id="day" class="fg">
<h1>FMS Symphony</h1>
<a id="fixie" target="_blank"></a>
</div>
<audio id="audio" controls autoplay style="display: block">
<source src="fms_symphony.ogg" type="audio/ogg" />
<source src="fms_symphony.mp3" type="audio/mp3" />
</audio>
</div>
<script type="text/javascript" src="data_files.js"></script>
<script>
// Number of images
var n = 1877
// Images variable
for (var i = n, images = []; i--;) images.push(null);
// Buffer on a seek or a page load.
var bufferSize = 100
window.onload = function() {
// Swap images
var audio = document.getElementById('audio')
audio.addEventListener('timeupdate', function() {
// Canvas
var canvas = document.getElementById('canvas')
var context = canvas.getContext('2d')
// Audio
var progress = audio.currentTime / audio.duration
// Current image
var i = Math.floor(n * progress) + 1
if (i >= n) {
return
}
// Set the hash.
window.location.hash = '#' + i
// If the image has been loaded, draw it.
// Draw nothing if it has not been loaded.
if (images[i]) {
context.drawImage(images[i], 0, 0)
}
// Start downloading another image.
for (var j = i; j < i + bufferSize; j++) {
if (j > n) {
break
}
if (images[j] == null) {
images[j] = new Image()
images[j].src = 'slideshow/' + j + '.png'
}
}
var fixie = document.getElementById('fixie')
var day = document.getElementById('day')
// Write the text
fixie.innerHTML = dataFiles['date'][i - 1]
fixie.href = dataFiles['url'][i - 1]
// Change the colors
document.body.setAttribute('class', dataFiles['dayOfWeek'][i - 1].toLowerCase())
// Clear, starting 10 frames back.
for (var j = 10; j < n; j ++) {
if (i - j < 1) {
// Stop when we hit 1.
break
}
images[i - j] = null
}
}, false)
audio.addEventListener('timeupdate', function() {
var progress = audio.currentTime / audio.duration
var i = Math.floor(n * progress) + 1
// Set hash.
var url = [location.protocol, '//', location.host, location.pathname, '#', i].join('')
// Track the seek.
if (piwikTracker) {
piwikTracker.trackPageView(url)
}
}, false)
document.getElementById('financial-crisis').addEventListener('click', function(e) {
e.preventDefault()
audio.pause()
audio.currentTime = audio.duration * ((777 - 2) / 1873)
audio.play()
return false
})
if (window.location.hash.length > 1) {
var specifiedFrame = window.location.hash.replace('#', '') * 1
audio.currentTime = audio.duration * specifiedFrame / n
}
}
</script>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik.thomaslevine.com/" : "http://piwik.thomaslevine.com/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 15);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://piwik.thomaslevine.com/piwik.php?idsite=15" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
</body>
</html>