-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
116 lines (100 loc) · 4.35 KB
/
index.html
File metadata and controls
116 lines (100 loc) · 4.35 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Matt Gilman</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/main.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var IMG_HEIGHT = 3264;
var IMG_WIDTH = 2448;
var COASTER_RADIUS = 55;
var COASTER_CX = 0;
var COASTER_CY = 0;
var getHeight = function () {
return $(window).height() - 50;
};
var svg = d3.select('#svg-container').append('svg');
// http://bl.ocks.org/jebeck/196406a3486985d2b92e
var getTextPathData = function () {
var r = COASTER_RADIUS * 0.95;
var startX = COASTER_CX / 2 - r;
return 'm' + startX + ',' + (COASTER_CY / 2) + ' ' +
'a' + r + ', ' + r + ' 0 0 0 ' + (2 * r) + ', 0';
};
svg.append('defs')
.append('path')
.attr('d', getTextPathData)
.attr('id', 'curvedTextPath');
var group = svg.append('g');
// background image
group.append('image')
.attr('xlink:href', 'imgs/matt-beer-min.jpg')
.attr('x', 0)
.attr('y', 0)
.attr('width', IMG_WIDTH)
.attr('height', IMG_HEIGHT);
// coaster group
var coasterGroup = group.append('g')
.attr('transform', function () {
var scale = 1 / (getHeight() / IMG_HEIGHT);
return 'translate(2125, 2950) scale(' + scale + ')';
});
// coaster
coasterGroup.append('circle')
.attr('cx', COASTER_CX)
.attr('cy', COASTER_CY)
.attr('r', COASTER_RADIUS);
// name
coasterGroup.append('text')
.attr('class', 'name')
.append('textPath')
.attr('startOffset', '0%')
.attr('xlink:href', '#curvedTextPath')
.text('Matt Gilman');
// github
coasterGroup.append('text')
.attr('class', 'link')
.append('textPath')
.attr('startOffset', '70%')
.attr('xlink:href', '#curvedTextPath')
.text('\uf09b')
.on('click', function () {
window.location = 'https://github.com/mcgilman';
});
// twitter
coasterGroup.append('text')
.attr('class', 'link')
.append('textPath')
.attr('startOffset', '90%')
.attr('xlink:href', '#curvedTextPath')
.text('\uf081')
.on('click', function () {
window.location = 'https://twitter.com/mattgilman';
});
var resizeSvg = function () {
var height = getHeight();
svg
.attr('width', height * 0.75)
.attr('height', height);
group.attr('transform', function () {
var scale = height / IMG_HEIGHT;
return 'scale(' + scale + ')';
});
};
resizeSvg();
$(window).on('resize', resizeSvg);
});
</script>
</head>
<body>
<div id="layout">
<div id="svg-container"></div>
</div>
</body>
</html>