Browse Source

Everything init

Tyler Hallada 8 years ago
commit
b870471ecc
6 changed files with 1259 additions and 0 deletions
  1. 493 0
      css/main.css
  2. 425 0
      css/normalize.css
  3. 60 0
      home.html
  4. 56 0
      index.html
  5. 8 0
      js/AnimationFrame.min.js
  6. 217 0
      js/stuff.js

+ 493 - 0
css/main.css

@@ -0,0 +1,493 @@
1
+/*****************************************************************************/
2
+/*
3
+/* Common
4
+/*
5
+/*****************************************************************************/
6
+
7
+/* Box sizing. Courtesy of Paul Irish
8
+ * (http://www.paulirish.com/2012/box-sizing-border-box-ftw/) */
9
+*, *:before, *:after {
10
+  -moz-box-sizing: border-box;
11
+  -webkit-box-sizing: border-box;
12
+  box-sizing: border-box;
13
+}
14
+
15
+html {
16
+  width: 100%;
17
+  height: 100%;
18
+  background: whitesmoke;
19
+}
20
+
21
+body {
22
+  font-family: 'Open Sans', Arial, sans-serif;
23
+  font-style: normal;
24
+  font-weight: 400;
25
+  color: #444;
26
+}
27
+
28
+h2 {
29
+  font-weight: 300;
30
+}
31
+
32
+hr {
33
+  width: 75%;
34
+}
35
+
36
+a {
37
+  color:FireBrick;
38
+  text-decoration: none;
39
+}
40
+
41
+p {
42
+  margin: 0 0 10px;
43
+}
44
+
45
+a:visited {
46
+  color:#855C85;
47
+}
48
+
49
+a:hover {
50
+  color:FireBrick;
51
+  text-decoration: underline;
52
+}
53
+
54
+canvas {
55
+  position: fixed;
56
+  top: 0;
57
+  left: 0;
58
+}
59
+
60
+blockquote {
61
+  margin-left: 20px;
62
+  margin-right: 20px;
63
+  padding-left: 1rem;
64
+  border-left: solid 3px #aaa;
65
+}
66
+
67
+blockquote p {
68
+  margin-bottom: 6px;
69
+}
70
+
71
+@font-face {
72
+    font-family: 'dejavu_sans_monobook';
73
+    src: url('DejaVuSansMono-webfont.eot');
74
+    src: url('DejaVuSansMono-webfont.eot?#iefix') format('embedded-opentype'),
75
+         url('DejaVuSansMono-webfont.woff') format('woff'),
76
+         url('DejaVuSansMono-webfont.ttf') format('truetype'),
77
+         url('DejaVuSansMono-webfont.svg#dejavu_sans_monobook') format('svg');
78
+    font-weight: normal;
79
+    font-style: normal;
80
+}
81
+
82
+/*****************************************************************************/
83
+/*
84
+/* Grid
85
+/*
86
+/*****************************************************************************/
87
+
88
+/* Grid. Courtesy of Adam Kaplan (http://www.adamkaplan.me/grid/) */
89
+.container {
90
+  margin: 0 auto;
91
+  max-width: 48rem;
92
+  width: 90%;
93
+}
94
+
95
+@media (min-width: 40rem) {
96
+  .column {
97
+    float: left;
98
+    padding-left: 1rem;
99
+    padding-right: 1rem;
100
+  }
101
+  
102
+  .column.full { width: 100%; }
103
+  .column.two-thirds { width: 66.7%; }
104
+  .column.half { width: 50%; }
105
+  .column.third { width: 33.3%; }
106
+  .column.fourth { width: 25%; }
107
+  .column.three-fourths { width: 75%; }
108
+  .column.flow-opposite { float: right; }  
109
+}
110
+
111
+.clearfix:before,
112
+.clearfix:after {
113
+  content: " ";
114
+  display: table;
115
+}
116
+ 
117
+.clearfix:after {
118
+  clear: both;
119
+}
120
+ 
121
+.clearfix {
122
+  *zoom: 1;
123
+}
124
+
125
+@media (min-width: 40rem) {
126
+  .column.flow-opposite { float: right; }
127
+}
128
+
129
+/* More suggestions from Jorden Lev (http://jordanlev.github.io/grid/) */
130
+@-webkit-viewport {width: device-width;}
131
+@-moz-viewport {width: device-width;}
132
+@-ms-viewport {width: device-width;}
133
+@-o-viewport {width: device-width;}
134
+@viewport {width: device-width;}
135
+
136
+img { width: auto; max-width: 100%; height: auto; }
137
+
138
+/* Credit http://avexdesigns.com/responsive-youtube-embed/#sthash.Q9VzxV8M.dpuf
139
+ * for this responsive video embed css */
140
+.video-container {
141
+  position: relative;
142
+  padding-bottom: 56.25%;
143
+  padding-top: 30px; height: 0; overflow: hidden;
144
+}
145
+ 
146
+.video-container iframe,
147
+.video-container object,
148
+.video-container embed {
149
+  position: absolute;
150
+  top: 0;
151
+  left: 0;
152
+  width: 100%;
153
+  height: 100%;
154
+  padding-bottom: 5px;
155
+}
156
+
157
+/* By me */
158
+.hide-mobile {
159
+  display: none;
160
+}
161
+.hide-desktop-inline-block { display: inline-block }
162
+.hide-desktop-block { display: block }
163
+.hide-desktop-inline { display: inline }
164
+
165
+@media (min-width: 40rem) {
166
+  .hide-desktop { display: none }
167
+  .hide-mobile-inline-block { display: inline-block }
168
+  .hide-mobile-block { display: block }
169
+  .hide-mobile-inline { display: inline }
170
+}
171
+
172
+/*****************************************************************************/
173
+/*
174
+/* Blog
175
+/*
176
+/*****************************************************************************/
177
+
178
+h1.title {
179
+  display: inline-block;
180
+  padding-right: 10px;
181
+  font-size: 2rem;
182
+  font-weight: 200;
183
+  margin: 0;
184
+}
185
+
186
+div.header {
187
+  margin: 20px 0 20px;
188
+  text-align: center;
189
+}
190
+
191
+@media (min-width: 40rem) {
192
+  div.header {
193
+    text-align: start;
194
+  }
195
+}
196
+
197
+div.header a {
198
+  color: FireBrick;
199
+}
200
+
201
+span.timestamp {
202
+  font-size: 0.85rem;
203
+  margin-top: 7px;
204
+}
205
+
206
+@media (min-width: 40rem) {
207
+  span.timestamp {
208
+    float: right;
209
+  }
210
+}
211
+
212
+.post-header {
213
+  padding-bottom: 10px;
214
+}
215
+
216
+a.read-more {
217
+  float: right;
218
+  font-size: 0.85rem;
219
+}
220
+
221
+h2.post-title {
222
+  margin-top: 0;
223
+  margin-bottom: 0;
224
+}
225
+
226
+@media (min-width: 40rem) {
227
+  p.contact-links {
228
+    float: right;
229
+  }
230
+}
231
+
232
+.contact {
233
+  text-align: center;
234
+  padding-bottom: 10px;
235
+}
236
+
237
+div.more-row {
238
+  padding-top: 5px;
239
+}
240
+
241
+div.pagination {
242
+  text-align: center;
243
+  margin-bottom: 10px;
244
+}
245
+
246
+div.rss {
247
+ text-align: center;
248
+}
249
+
250
+a.rss img {
251
+  max-width: 16px;
252
+  max-height: 16px;
253
+  margin: 0.5rem 0;
254
+}
255
+
256
+/*****************************************************************************/
257
+/*
258
+/* Posts
259
+/*
260
+/*****************************************************************************/
261
+
262
+/* standard */
263
+.post pre {
264
+  border: 1px solid #ddd;
265
+  background-color: #eef;
266
+  padding: 0 .4em;
267
+  white-space: pre;
268
+}
269
+
270
+@media (min-width: 40rem) {
271
+  .post pre {
272
+    white-space: pre-wrap;
273
+  }
274
+}
275
+
276
+.post ul, .post ol {
277
+  margin-left: 0;
278
+  padding-left: 20px;
279
+}
280
+
281
+@media (min-width: 40rem) {
282
+  .post ul, .post ol {
283
+    margin-left: 0.5em;
284
+    padding-left: 40px;
285
+  }
286
+}
287
+
288
+.post code {
289
+  border: 1px solid #ddd;
290
+  background-color: #eef;
291
+  padding: 0 .2em;
292
+  font-size: 8pt;
293
+  font-family: 'dejavu_sans_monobook', Courier, monospace;
294
+}
295
+
296
+@media (min-width: 40rem) {
297
+  .post code {
298
+    font-size: 10pt;
299
+  }
300
+}
301
+
302
+.post pre code {
303
+  border: none;
304
+  padding: 0;
305
+}
306
+
307
+/* terminal */
308
+.post pre.terminal {
309
+  border: 1px solid #000;
310
+  background-color: #333;
311
+  color: #FFF;
312
+}
313
+
314
+.post pre.terminal code {
315
+  background-color: #333;
316
+}
317
+
318
+.post img.half-left {
319
+  float: none;
320
+  width: 100%;
321
+}
322
+
323
+.post img.half-right {
324
+  float: none;
325
+  width: 100%;
326
+}
327
+
328
+@media (min-width: 40rem) {
329
+  .post img.half-left {
330
+    float: left;
331
+    width: 49%;
332
+    margin-bottom: 10px;
333
+  }
334
+  .post img.half-right {
335
+    float: right;
336
+    width: 49%;
337
+    margin-bottom: 10px;
338
+  }
339
+}
340
+
341
+/*****************************************************************************/
342
+/*
343
+/* Homepage
344
+/*
345
+/*****************************************************************************/
346
+
347
+#home {
348
+  display: block;
349
+  position: relative;
350
+  padding-top: 1.5rem;
351
+}
352
+
353
+/* credit to http://codepen.io/bennettfeely/pen/Ftczh for a lot of this css */
354
+
355
+.card {
356
+  position: relative;
357
+  z-index: 2;
358
+  padding: 1rem;
359
+  box-shadow: 0 1px 2px #aaa;
360
+  background: white;
361
+  margin: 0 0.5rem 1rem;
362
+  border-radius: 3px;
363
+  user-select: none;
364
+}
365
+
366
+h1.big-name {
367
+  font-size: 2rem;
368
+  font-weight: 200;
369
+  margin-top: 0;
370
+  text-align: center;
371
+}
372
+
373
+#front-quote , #front-quote, .profile-card-desc p {
374
+    margin-top: 0;
375
+    margin-bottom: 0;
376
+}
377
+
378
+.profile-card-portrait {
379
+  width: 100%;
380
+  margin-bottom: 1.5rem;
381
+}
382
+
383
+.profile-card-quote {
384
+  margin-top: 1.5rem;
385
+}
386
+
387
+.profile-card-portrait img {
388
+  margin: 0 auto;
389
+  display: block;
390
+}
391
+
392
+.profile-card-desc {
393
+    margin-top: 1.25rem;
394
+}
395
+
396
+@media (min-width: 40rem) {
397
+  .profile-card-portrait {
398
+    margin-bottom: 0;
399
+  }
400
+  .profile-card-links {
401
+    margin-top: 0;
402
+  }
403
+}
404
+
405
+.link-card {
406
+  text-align: center;
407
+  text-decoration: none;
408
+}
409
+
410
+.link-card img {
411
+  max-width: 64px;
412
+  max-height: 64px;
413
+}
414
+
415
+.mobile-half {
416
+  padding: 0;
417
+  float: left;
418
+  width: 50%;
419
+}
420
+
421
+@media (min-width: 40rem) {
422
+  .mobile-half {
423
+    padding: 0;
424
+  }
425
+}
426
+
427
+a.no-decoration {
428
+  color: #444;
429
+  display: block;
430
+}
431
+
432
+a.no-decoration:visited {
433
+  color: #444;
434
+}
435
+
436
+a.no-decoration:hover {
437
+  color: #444;
438
+  text-decoration: none;
439
+}
440
+
441
+/*****************************************************************************/
442
+/*
443
+/* Magic
444
+/*
445
+/*****************************************************************************/
446
+
447
+div.controls-tab button {
448
+  width: 28px;
449
+  height: 28px;
450
+}
451
+
452
+div.options-panel {
453
+  position: fixed;
454
+  bottom: 0;
455
+  left: 0;
456
+  padding: 10px;
457
+  width: 100%;
458
+  z-index: 10;
459
+  height: auto;
460
+  background-color: rgba(140,120,100,0.75);
461
+  color: white;
462
+}
463
+
464
+div.controls-tab {
465
+  position: relative;
466
+}
467
+
468
+div.controls {
469
+  position: absolute;
470
+  top: -2.6rem;
471
+  right: 1rem;
472
+  height: 2rem;
473
+  padding-right: 5px;
474
+  padding-left: 5px;
475
+  background-color: rgba(140,120,100,0.75);
476
+}
477
+
478
+div.controls button {
479
+  padding: 0.25rem;
480
+  margin-top: 0.25rem;
481
+  background-color: rgb(100, 100, 100);
482
+  border: 1px grey solid;
483
+  color: white;
484
+  font-size: small;
485
+}
486
+
487
+div.options-panel form {
488
+  text-align: center
489
+}
490
+
491
+div.options-panel form label {
492
+  display: block;
493
+}

+ 425 - 0
css/normalize.css

@@ -0,0 +1,425 @@
1
+/*! normalize.css v3.0.1 | MIT License | git.io/normalize */
2
+
3
+/**
4
+ * 1. Set default font family to sans-serif.
5
+ * 2. Prevent iOS text size adjust after orientation change, without disabling
6
+ *    user zoom.
7
+ */
8
+
9
+html {
10
+  font-family: sans-serif; /* 1 */
11
+  -ms-text-size-adjust: 100%; /* 2 */
12
+  -webkit-text-size-adjust: 100%; /* 2 */
13
+}
14
+
15
+/**
16
+ * Remove default margin.
17
+ */
18
+
19
+body {
20
+  margin: 0;
21
+}
22
+
23
+/* HTML5 display definitions
24
+   ========================================================================== */
25
+
26
+/**
27
+ * Correct `block` display not defined for any HTML5 element in IE 8/9.
28
+ * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox.
29
+ * Correct `block` display not defined for `main` in IE 11.
30
+ */
31
+
32
+article,
33
+aside,
34
+details,
35
+figcaption,
36
+figure,
37
+footer,
38
+header,
39
+hgroup,
40
+main,
41
+nav,
42
+section,
43
+summary {
44
+  display: block;
45
+}
46
+
47
+/**
48
+ * 1. Correct `inline-block` display not defined in IE 8/9.
49
+ * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
50
+ */
51
+
52
+audio,
53
+canvas,
54
+progress,
55
+video {
56
+  display: inline-block; /* 1 */
57
+  vertical-align: baseline; /* 2 */
58
+}
59
+
60
+/**
61
+ * Prevent modern browsers from displaying `audio` without controls.
62
+ * Remove excess height in iOS 5 devices.
63
+ */
64
+
65
+audio:not([controls]) {
66
+  display: none;
67
+  height: 0;
68
+}
69
+
70
+/**
71
+ * Address `[hidden]` styling not present in IE 8/9/10.
72
+ * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
73
+ */
74
+
75
+[hidden],
76
+template {
77
+  display: none;
78
+}
79
+
80
+/* Links
81
+   ========================================================================== */
82
+
83
+/**
84
+ * Remove the gray background color from active links in IE 10.
85
+ */
86
+
87
+a {
88
+  background: transparent;
89
+}
90
+
91
+/**
92
+ * Improve readability when focused and also mouse hovered in all browsers.
93
+ */
94
+
95
+a:active,
96
+a:hover {
97
+  outline: 0;
98
+}
99
+
100
+/* Text-level semantics
101
+   ========================================================================== */
102
+
103
+/**
104
+ * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
105
+ */
106
+
107
+abbr[title] {
108
+  border-bottom: 1px dotted;
109
+}
110
+
111
+/**
112
+ * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
113
+ */
114
+
115
+b,
116
+strong {
117
+  font-weight: bold;
118
+}
119
+
120
+/**
121
+ * Address styling not present in Safari and Chrome.
122
+ */
123
+
124
+dfn {
125
+  font-style: italic;
126
+}
127
+
128
+/**
129
+ * Address variable `h1` font-size and margin within `section` and `article`
130
+ * contexts in Firefox 4+, Safari, and Chrome.
131
+ */
132
+
133
+h1 {
134
+  font-size: 2em;
135
+  margin: 0.67em 0;
136
+}
137
+
138
+/**
139
+ * Address styling not present in IE 8/9.
140
+ */
141
+
142
+mark {
143
+  background: #ff0;
144
+  color: #000;
145
+}
146
+
147
+/**
148
+ * Address inconsistent and variable font size in all browsers.
149
+ */
150
+
151
+small {
152
+  font-size: 80%;
153
+}
154
+
155
+/**
156
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
157
+ */
158
+
159
+sub,
160
+sup {
161
+  font-size: 75%;
162
+  line-height: 0;
163
+  position: relative;
164
+  vertical-align: baseline;
165
+}
166
+
167
+sup {
168
+  top: -0.5em;
169
+}
170
+
171
+sub {
172
+  bottom: -0.25em;
173
+}
174
+
175
+/* Embedded content
176
+   ========================================================================== */
177
+
178
+/**
179
+ * Remove border when inside `a` element in IE 8/9/10.
180
+ */
181
+
182
+img {
183
+  border: 0;
184
+}
185
+
186
+/**
187
+ * Correct overflow not hidden in IE 9/10/11.
188
+ */
189
+
190
+svg:not(:root) {
191
+  overflow: hidden;
192
+}
193
+
194
+/* Grouping content
195
+   ========================================================================== */
196
+
197
+/**
198
+ * Address margin not present in IE 8/9 and Safari.
199
+ */
200
+
201
+figure {
202
+  margin: 1em 40px;
203
+}
204
+
205
+/**
206
+ * Address differences between Firefox and other browsers.
207
+ */
208
+
209
+hr {
210
+  -moz-box-sizing: content-box;
211
+  box-sizing: content-box;
212
+  height: 0;
213
+}
214
+
215
+/**
216
+ * Contain overflow in all browsers.
217
+ */
218
+
219
+pre {
220
+  overflow: auto;
221
+}
222
+
223
+/**
224
+ * Address odd `em`-unit font size rendering in all browsers.
225
+ */
226
+
227
+code,
228
+kbd,
229
+pre,
230
+samp {
231
+  font-family: monospace, monospace;
232
+  font-size: 1em;
233
+}
234
+
235
+/* Forms
236
+   ========================================================================== */
237
+
238
+/**
239
+ * Known limitation: by default, Chrome and Safari on OS X allow very limited
240
+ * styling of `select`, unless a `border` property is set.
241
+ */
242
+
243
+/**
244
+ * 1. Correct color not being inherited.
245
+ *    Known issue: affects color of disabled elements.
246
+ * 2. Correct font properties not being inherited.
247
+ * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
248
+ */
249
+
250
+button,
251
+input,
252
+optgroup,
253
+select,
254
+textarea {
255
+  color: inherit; /* 1 */
256
+  font: inherit; /* 2 */
257
+  margin: 0; /* 3 */
258
+}
259
+
260
+/**
261
+ * Address `overflow` set to `hidden` in IE 8/9/10/11.
262
+ */
263
+
264
+button {
265
+  overflow: visible;
266
+}
267
+
268
+/**
269
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
270
+ * All other form control elements do not inherit `text-transform` values.
271
+ * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
272
+ * Correct `select` style inheritance in Firefox.
273
+ */
274
+
275
+button,
276
+select {
277
+  text-transform: none;
278
+}
279
+
280
+/**
281
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
282
+ *    and `video` controls.
283
+ * 2. Correct inability to style clickable `input` types in iOS.
284
+ * 3. Improve usability and consistency of cursor style between image-type
285
+ *    `input` and others.
286
+ */
287
+
288
+button,
289
+html input[type="button"], /* 1 */
290
+input[type="reset"],
291
+input[type="submit"] {
292
+  -webkit-appearance: button; /* 2 */
293
+  cursor: pointer; /* 3 */
294
+}
295
+
296
+/**
297
+ * Re-set default cursor for disabled elements.
298
+ */
299
+
300
+button[disabled],
301
+html input[disabled] {
302
+  cursor: default;
303
+}
304
+
305
+/**
306
+ * Remove inner padding and border in Firefox 4+.
307
+ */
308
+
309
+button::-moz-focus-inner,
310
+input::-moz-focus-inner {
311
+  border: 0;
312
+  padding: 0;
313
+}
314
+
315
+/**
316
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
317
+ * the UA stylesheet.
318
+ */
319
+
320
+input {
321
+  line-height: normal;
322
+}
323
+
324
+/**
325
+ * It's recommended that you don't attempt to style these elements.
326
+ * Firefox's implementation doesn't respect box-sizing, padding, or width.
327
+ *
328
+ * 1. Address box sizing set to `content-box` in IE 8/9/10.
329
+ * 2. Remove excess padding in IE 8/9/10.
330
+ */
331
+
332
+input[type="checkbox"],
333
+input[type="radio"] {
334
+  box-sizing: border-box; /* 1 */
335
+  padding: 0; /* 2 */
336
+}
337
+
338
+/**
339
+ * Fix the cursor style for Chrome's increment/decrement buttons. For certain
340
+ * `font-size` values of the `input`, it causes the cursor style of the
341
+ * decrement button to change from `default` to `text`.
342
+ */
343
+
344
+input[type="number"]::-webkit-inner-spin-button,
345
+input[type="number"]::-webkit-outer-spin-button {
346
+  height: auto;
347
+}
348
+
349
+/**
350
+ * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
351
+ * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
352
+ *    (include `-moz` to future-proof).
353
+ */
354
+
355
+input[type="search"] {
356
+  -webkit-appearance: textfield; /* 1 */
357
+  -moz-box-sizing: content-box;
358
+  -webkit-box-sizing: content-box; /* 2 */
359
+  box-sizing: content-box;
360
+}
361
+
362
+/**
363
+ * Remove inner padding and search cancel button in Safari and Chrome on OS X.
364
+ * Safari (but not Chrome) clips the cancel button when the search input has
365
+ * padding (and `textfield` appearance).
366
+ */
367
+
368
+input[type="search"]::-webkit-search-cancel-button,
369
+input[type="search"]::-webkit-search-decoration {
370
+  -webkit-appearance: none;
371
+}
372
+
373
+/**
374
+ * Define consistent border, margin, and padding.
375
+ */
376
+
377
+fieldset {
378
+  border: 1px solid #c0c0c0;
379
+  margin: 0 2px;
380
+  padding: 0.35em 0.625em 0.75em;
381
+}
382
+
383
+/**
384
+ * 1. Correct `color` not being inherited in IE 8/9/10/11.
385
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
386
+ */
387
+
388
+legend {
389
+  border: 0; /* 1 */
390
+  padding: 0; /* 2 */
391
+}
392
+
393
+/**
394
+ * Remove default vertical scrollbar in IE 8/9/10/11.
395
+ */
396
+
397
+textarea {
398
+  overflow: auto;
399
+}
400
+
401
+/**
402
+ * Don't inherit the `font-weight` (applied by a rule above).
403
+ * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
404
+ */
405
+
406
+optgroup {
407
+  font-weight: bold;
408
+}
409
+
410
+/* Tables
411
+   ========================================================================== */
412
+
413
+/**
414
+ * Remove most spacing between table cells.
415
+ */
416
+
417
+table {
418
+  border-collapse: collapse;
419
+  border-spacing: 0;
420
+}
421
+
422
+td,
423
+th {
424
+  padding: 0;
425
+}

+ 60 - 0
home.html

@@ -0,0 +1,60 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+    <title>UI Stuff</title>
7
+    <meta name="viewport" content="width=device-width, initial-scale=1, max-scale=1">
8
+
9
+    <!-- 3rd party CSS -->
10
+    <link rel="stylesheet" href="/css/normalize.css">
11
+    <!-- Fix IE -->
12
+    <!--[if lt IE 9]>
13
+      <script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
14
+      <script src="http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
15
+    <![endif]-->
16
+
17
+    <!-- syntax highlighting CSS -->
18
+    <link rel="stylesheet" href="/css/syntax.css">
19
+
20
+    <!-- Custom CSS -->
21
+    <link rel="stylesheet" href="/css/main.css">
22
+
23
+    <!-- RSS Feed -->
24
+    <link href='/feed.xml' rel='alternate' type='application/atom+xml'>
25
+
26
+    <!-- Web Fonts -->
27
+    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,400italics,300,300italics,200' rel='stylesheet' type='text/css'>
28
+
29
+    <!-- Icon Fonts -->
30
+    <link rel="stylesheet" href="/css/ionicons.min.css">
31
+
32
+    <!-- Favicon -->
33
+    <link rel="shortcut icon" href="/favicon.png" />
34
+
35
+    <!-- Scripts -->
36
+    <script src="/js/AnimationFrame.min.js"></script>
37
+    <script async src="/js/magic.js"></script>
38
+
39
+    <!-- Google Analytics -->
40
+    <script>
41
+    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
42
+    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
43
+    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
44
+    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
45
+
46
+    ga('create', 'UA-39880341-1', 'auto');
47
+    ga('send', 'pageview');
48
+
49
+    </script>
50
+    <!-- End Google Analytics -->
51
+  </head>
52
+  <body>
53
+  <canvas id="magic"></canvas>
54
+  </body>
55
+  <script>
56
+    window.onload = function () {
57
+      new Stuff().draw();
58
+    }
59
+  </script>
60
+</html>

+ 56 - 0
index.html

@@ -0,0 +1,56 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+    <title>Stuff</title>
7
+    <meta name="viewport" content="width=device-width, initial-scale=1, max-scale=1">
8
+
9
+    <!-- 3rd party CSS -->
10
+    <link rel="stylesheet" href="/css/normalize.css">
11
+    <!-- Fix IE -->
12
+    <!--[if lt IE 9]>
13
+      <script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
14
+      <script src="http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
15
+    <![endif]-->
16
+
17
+    <!-- Custom CSS -->
18
+    <link rel="stylesheet" href="/css/main.css">
19
+
20
+    <!-- RSS Feed -->
21
+    <link href='/feed.xml' rel='alternate' type='application/atom+xml'>
22
+
23
+    <!-- Web Fonts -->
24
+    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,400italics,300,300italics,200' rel='stylesheet' type='text/css'>
25
+
26
+    <!-- Favicon -->
27
+    <link rel="shortcut icon" href="/favicon.png" />
28
+
29
+    <!-- Scripts -->
30
+    <script src="/js/AnimationFrame.min.js"></script>
31
+    <script async src="/js/stuff.js"></script>
32
+
33
+    <!-- Google Analytics -->
34
+    <script>
35
+    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
36
+    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
37
+    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
38
+    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
39
+
40
+    ga('create', 'UA-39880341-1', 'auto');
41
+    ga('send', 'pageview');
42
+
43
+    </script>
44
+    <!-- End Google Analytics -->
45
+  </head>
46
+  <body>
47
+  <canvas id="magic"></canvas>
48
+    <div class="container">
49
+    </div>
50
+  </body>
51
+  <script>
52
+    window.onload = function () {
53
+      new Stuff().draw();
54
+    }
55
+  </script>
56
+</html>

File diff suppressed because it is too large
+ 8 - 0
js/AnimationFrame.min.js


+ 217 - 0
js/stuff.js

@@ -0,0 +1,217 @@
1
+var Stuff = function (options) {
2
+    options = options || {};
3
+    this.paused = false;
4
+
5
+    // Save this query here now that the page is loaded
6
+    this.canvas = document.getElementById("magic");
7
+
8
+    this.counter = 0;
9
+};
10
+
11
+
12
+/* Get the height and width of full document. To avoid browser
13
+ * incompatibility issues, choose the maximum of all height/width values.
14
+ *
15
+ * Method from http://stackoverflow.com/a/1147768 */
16
+Stuff.prototype.getDocumentDimensions = function () {
17
+    var body = document.body,
18
+        html = document.documentElement;
19
+
20
+    var height = Math.max(body.scrollHeight, body.offsetHeight, 
21
+                          html.clientHeight, html.scrollHeight,
22
+                          html.offsetHeight);
23
+
24
+    var width = Math.max(body.scrollWidth, body.offsetWidth, 
25
+                         html.clientWidth, html.scrollWidth,
26
+                         html.offsetWidth);
27
+    
28
+    return {"height": height, "width": width};
29
+};
30
+
31
+/* Choose a random RGB color to begin the color gradient with */
32
+Stuff.prototype.pickRandomColor = function() {
33
+    return {"r": Math.floor(Math.random() * (255 + 1)),
34
+            "g": Math.floor(Math.random() * (255 + 1)),
35
+            "b": Math.floor(Math.random() * (255 + 1))};
36
+};
37
+
38
+Stuff.prototype.clear = function() {
39
+    this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
40
+};
41
+
42
+Stuff.prototype.getRandomInRange = function(min, max, negative) {
43
+    rand = Math.floor(Math.random() * (max - min + 1)) + min;
44
+    if (negative) {
45
+        if (Math.random() < 0.5) {
46
+            rand = rand * -1;
47
+        }
48
+    }
49
+    return rand;
50
+};
51
+
52
+Stuff.prototype.sortedInsert = function(ordered_array, value, to_insert) {
53
+    for (i = 0; i < ordered_array.length; i++) {
54
+        if (ordered_array[i] >= value) {
55
+            ordered_array.splice(i, 0, to_insert);
56
+            return;
57
+        }
58
+    }
59
+    ordered_array.push(to_insert);
60
+};
61
+
62
+Stuff.prototype.lineToNearestPoints = function(context, ordered_array) {
63
+    for (i = 0; i < ordered_array.length; i++) {
64
+        point = ordered_array[i];
65
+        context.beginPath();
66
+        context.strokeStyle = 'black';
67
+        context.moveTo(point.x, point.y);
68
+        if (i !== 0) {
69
+            point_before = ordered_array[i-1];
70
+            context.lineTo(point_before.x, point_before.y);
71
+        }
72
+        context.moveTo(point.x, point.y);
73
+        if (i !== (ordered_array.length - 1)) {
74
+            point_after = ordered_array[i+1];
75
+            context.lineTo(point_after.x, point_after.y);
76
+        }
77
+        context.stroke();
78
+        context.closePath();
79
+    }
80
+};
81
+
82
+Stuff.prototype.initPoints = function(width, height, num_points) {
83
+    this.points = [];
84
+    for (i = 0; i < num_points; i++) {
85
+        random_x = Math.floor(Math.random() * (width + 1));
86
+        random_y = Math.floor(Math.random() * (height + 1));
87
+        point = {'x': random_x, 'y': random_y};
88
+        this.points.push(point);
89
+    }
90
+};
91
+
92
+Stuff.prototype.distance = function(point1, point2) {
93
+    return Math.sqrt(Math.pow((point1.x - point2.x), 2) + Math.pow((point1.y - point2.y), 2));
94
+};
95
+
96
+Stuff.prototype.drawPolygon = function(context) {
97
+    for (i = 0; i < this.points.length; i++) {
98
+        if (this.converge_point) {
99
+            if (this.points[i].x >= this.converge_point.x) {
100
+                this.points[i].x = this.points[i].x - 3;
101
+            } else {
102
+                this.points[i].x = this.points[i].x + 3;
103
+            }
104
+            if (this.points[i].y >= this.converge_point.y) {
105
+                this.points[i].y = this.points[i].y - 3;
106
+            } else {
107
+                this.points[i].y = this.points[i].y + 3;
108
+            }
109
+        } else if (this.counter % 10 === 0) {
110
+            if (Math.random() < 0.5) {
111
+                this.points[i].y = this.points[i].y - 10;
112
+            } else {
113
+                this.points[i].y = this.points[i].y + 10;
114
+            }
115
+        } else if ((this.mouse_position) && (this.distance(this.mouse_position, this.points[i]) < 50)) {
116
+            if (this.points[i].x >= this.mouse_position.x) {
117
+                this.points[i].x = this.points[i].x + 3;
118
+            } else {
119
+                this.points[i].x = this.points[i].x - 3;
120
+            }
121
+            if (this.points[i].y >= this.mouse_position.y) {
122
+                this.points[i].y = this.points[i].y + 3;
123
+            } else {
124
+                this.points[i].y = this.points[i].y - 3;
125
+            }
126
+        } else {
127
+            this.points[i].x = this.points[i].x + this.getRandomInRange(0, 2, true);
128
+            this.points[i].y = this.points[i].y + this.getRandomInRange(0, 2, true);
129
+        }
130
+        // this.x_sorted = [];
131
+        // this.y_sorted = [];
132
+        // this.sortedInsert(this.x_sorted, this.points[i].x, point);
133
+        // this.sortedInsert(this.y_sorted, this.points[i].y, point);
134
+
135
+        context.beginPath();
136
+        context.strokeStyle = 'black';
137
+        context.arc(this.points[i].x, this.points[i].y, 1, 0, 2*Math.PI);
138
+        context.stroke();
139
+        context.closePath();
140
+    }
141
+
142
+    this.converge_point = null;
143
+    // this.lineToNearestPoints(context, this.x_sorted);
144
+    // this.lineToNearestPoints(context, this.y_sorted);
145
+};
146
+
147
+/* Most of this funtion is provided by Maissan Inc. in their tutorial:
148
+   http://www.maissan.net/articles/simulating-vines */
149
+ Stuff.prototype.drawThing = function(context, sort, prune, chain) {
150
+    var AnimationFrame = window.AnimationFrame;
151
+    AnimationFrame.shim();
152
+    var animationFrame = new AnimationFrame(30),
153
+        timeCounter = 0,
154
+        color,
155
+        gradient;
156
+    context.lineWidth = 0.5;
157
+    
158
+    var self = this;
159
+    function animate(time) {
160
+        // resize canvas if document size changed
161
+        dimensions = self.getDocumentDimensions();
162
+        if ((dimensions.height !== self.canvas.height) ||
163
+            (dimensions.width !== self.canvas.width)) {
164
+            self.canvas.height = dimensions.height;
165
+            self.canvas.width = dimensions.width;
166
+        }
167
+        if (self.points === undefined) {
168
+            self.initPoints(self.canvas.width, self.canvas.height, 5000);
169
+        }
170
+
171
+        if (!self.paused) {
172
+            self.clear();
173
+            self.drawPolygon(context);
174
+            self.counter = self.counter + 1;
175
+        }
176
+        frameId = animationFrame.request(animate);
177
+    }
178
+
179
+    // Drawing interval
180
+    var frameId = animationFrame.request(animate);
181
+    return frameId;
182
+};
183
+
184
+Stuff.prototype.canvasClickHandler = function(event) {
185
+    var x = event.pageX;
186
+    var y = event.pageY;
187
+    this.converge_point = {'x': x, 'y': y};
188
+    color = this.pickRandomColor();
189
+    this.canvas.style.backgroundColor = "rgb(" + color.r + "," + color.g + "," + color.b + ")";
190
+};
191
+
192
+Stuff.prototype.canvasMouseMoveHandler = function(event) {
193
+    var x = event.pageX;
194
+    var y = event.pageY;
195
+    this.mouse_position = {'x': x, 'y': y};
196
+};
197
+
198
+Stuff.prototype.draw = function() {
199
+    var interval_time = 2000;
200
+
201
+    // Initialize canvas
202
+    var dimensions = this.getDocumentDimensions();
203
+    this.canvas.height = dimensions.height;
204
+    this.canvas.width = dimensions.width;
205
+
206
+    // Check for canvas support, bind click event, and get context
207
+    if (this.canvas.getContext){
208
+        var self = this;
209
+        this.canvas.addEventListener("click", function () { self.canvasClickHandler.apply(self, arguments); });
210
+        this.canvas.addEventListener("mousemove", function () { self.canvasMouseMoveHandler.apply(self, arguments); });
211
+
212
+        this.context = this.canvas.getContext("2d");
213
+
214
+        // Draw stuff
215
+        var frameId = this.drawThing(this.context, false, true, true);
216
+    }
217
+};