-
Notifications
You must be signed in to change notification settings - Fork 0
/
anim-1.html
212 lines (182 loc) · 9.73 KB
/
anim-1.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
<html>
<head>
<link href="https://fonts.googleapis.com/" rel="preconnect" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i|Space+Mono:400,700" rel="preload" as="style" />
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i|Space+Mono:400,700"
rel="stylesheet"
/>
<style>
html, body {
background: #0c0c0c;
margin: 0;
padding: 0;
font-family: 'Roboto', 'sans-serif';
}
svg {
position: relative;
outline: red;
width: 100%;
height: 100%;
z-index: 1;
}
#Visual {
position: relative;
width: 100%;
height: calc(100vw * 0.32926829);
background: hsla(7, 69%, 25%, 1);
}
#presentation {
z-index: 10;
position: absolute;
height: calc(100vw * 0.32926829);
width: calc(calc(100vw * 0.32926829) / 0.5625);
background: gray;
top: 0;
right: 0;
}
#silhouette {
z-index: 10;
position: absolute;
background: url(./silhouette.png) no-repeat;
background-size: contain;
height: 64%;
width: 10%;
left: 17vw;
bottom: -4%;
}
.fill {
fill: #fff;
stroke: #fff;
stroke-miterlimit: 10;
opacity: 0;
transition: opacity 2s;
}
.fill-group {
clip-path:url(#mask);
}
.mask path {
fill:none;
}
.fill.show {
opacity: 1;
}
#speakerInfo {
position: absolute;
top: 0;
left: 0;
color: white;
opacity: .7;
}
#speakerInfo .name,
#speakerInfo .topic {
display: block;
}
#speakerInfo .name {
font-size: calc( 3 * calc(calc(100vw * 0.32926829) / 100) );
}
#speakerInfo .topic {
font-size: calc( 3.3 * calc(calc(100vw * 0.32926829) / 100) );
}
</style>
<script>
const clusterLength = 4;
let currentCluster = 0;
let clusters = [];
let nextClusterTimeout = 3000
const readClusters = () => {
return Array
.from(document.querySelectorAll('polygon[class^=cluster-]'))
.reduce((arr, triangle) => {
const indexMatch = triangle.className.baseVal.match(/^cluster-(\d)/);
if (indexMatch) {
if (!arr[indexMatch[1] - 1]) {
arr.push([])
}
arr[indexMatch[1] - 1].push(triangle);
}
return arr;
}, []);
}
const showPolygon = async (polygon, timeout) => {
return new Promise((resolve) => {
polygon.className.baseVal += ' show';
setTimeout(resolve, timeout);
})
}
const hidePolygon = async (polygon, timeout) => {
return new Promise((resolve) => {
polygon.className.baseVal = polygon.className.baseVal.replace(' show', '');
setTimeout(resolve, timeout);
})
}
const show = async () => {
const prevCluster = currentCluster !== 0 ? clusters[currentCluster - 1] : clusters[clusters.length - 1];
const nextCluster = clusters[currentCluster]
const prevLength = prevCluster.length;
const nextLength = nextCluster.length;
for (let i = 0 ; i < clusterLength ; i++) {
const prevPolygon = prevCluster[i];
const nextPolygon = nextCluster[i];
await Promise.all([
hidePolygon(prevPolygon, 200),
showPolygon(nextPolygon, 200)
])
}
currentCluster += 1;
if (!clusters[currentCluster]) {
currentCluster = 0;
}
setTimeout(show, nextClusterTimeout);
}
</script>
</head>
<body>
<div id="Visual">
<svg data-name="Layer 3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="3280" height="1080" viewBox="0 0 3280 1080">
<defs>
<clipPath id="mask" class="mask">
<path d="M1596.53,386l-43.77,43.77h89L1597.94,386l42.56-42.56,43.27,43.26,44.47-44.47H1554.18l-44-44V387.2L1554,343.44Zm129.29-42.76-42,42.06-42.06-42.06Zm-170.64,85.53,42-42.06,42.06,42.06Zm84.11-85.53-42,42.06-42.06-42.06Zm-128.08,41.56V300.67l41.55,41.56h0l.5.5ZM1857.32,472v-.71l-.5.5-42.06-42.05h0l-44.48-44.47-44.47,44.47h86.53L1769.09,473h86.52l-42.76,42.76,44.47,44.47V473.72l42.77,42.77L1944.56,472Zm-87-85.32,42.06,42.06h-84.11ZM1813.56,430,1855.62,472H1771.5Zm42.76,127.88-42-42.06,42-42.06ZM1858,473h84.12l-42.06,42.06Zm-44,215.61V601.1l-44.48,44.48,43.27,43.26-42.77,42.76h-85.82V644.37l-44,44h-85.82V602.81h.71l-.71-.71v-1l-.5.5-43.27-43.26-42.76,42.76V516l44-44h-87.52l-42.77-42.76h0l-44.47-44.48v87.53l-.71.71h.71v.71l.71-.71H1424l42.76,42.76-43.26,43.27,43.26,43.26-.5.5h0l-42.76,42.77,44.47,44.47V602.81h84.82L1510,645.58l44.47,44.47h0l42.77,42.76,43.26-43.26,43.76,43.76h0L1727,776.07l43.47-43.47H1858ZM1338.15,387.2l42,42.06-21,21-21,21Zm21.23,64.29L1380.91,430,1423,472h-84.11Zm66,21.53h84.12l-41.56,41.56h0l-.5.5Zm41.56,44v84.12l-42.06-42.06Zm0,170.65-42.06-42.06,42.06-42.06Zm43.76-127.89,42.06,42.06h-84.11Zm42.77,43.77v84.12l-42.06-42.06Zm43.77,127.88-42.06-42.06h84.11Zm86-84.62V730.9l-42-42.06Zm129.8-43.26v84.11l-42.06-42Zm-86,171.14L1685,732.6h84.11Zm44.47-43.06,42-42.05,42.06,42.05Z"/>
</clipPath>
</defs>
<g class="fill-group">
<polygon class="cluster-1 fill" points="1510.91 342.52 1510.91 299.26 1554.17 342.52 1510.91 385.79 1510.91 342.52"/>
<polygon class="cluster-1 fill" points="1597.44 342.52 1640.7 342.52 1597.44 385.79 1554.17 342.52 1597.44 342.52"/>
<polygon class="cluster-1 fill" points="1597.44 429.05 1554.17 429.05 1597.44 385.79 1640.7 429.05 1597.44 429.05"/>
<polygon class="cluster-1 fill" points="1683.97 342.52 1727.23 342.52 1683.97 385.79 1640.7 342.52 1683.97 342.52"/>
<polygon class="cluster-2 fill" points="1770.5 429.05 1727.23 429.05 1770.5 385.79 1813.76 429.05 1770.5 429.05"/>
<polygon class="cluster-2 fill" points="1813.76 472.31 1770.5 472.31 1813.76 429.05 1857.03 472.31 1813.76 472.31"/>
<polygon class="cluster-2 fill" points="1857.03 515.58 1857.03 558.84 1813.76 515.58 1857.03 472.31 1857.03 515.58"/>
<polygon class="cluster-2 fill" points="1900.29 472.31 1943.56 472.31 1900.3 515.58 1857.03 472.31 1900.29 472.31"/>
<polygon class="cluster-3 fill" points="1813.76 645.37 1813.76 688.63 1770.5 645.37 1813.76 602.1 1813.76 645.37"/>
<polygon class="cluster-3 fill" points="1813.76 731.9 1770.5 731.9 1813.76 688.63 1857.03 731.9 1813.76 731.9"/>
<polygon class="cluster-3 fill" points="1727.23 731.9 1770.5 731.9 1727.23 775.16 1683.97 731.9 1727.23 731.9"/>
<polygon class="cluster-3 fill" points="1683.97 688.63 1683.97 731.9 1640.7 688.63 1683.97 645.37 1683.97 688.63"/>
<polygon class="cluster-4 fill" points="1597.44 688.63 1640.7 688.63 1597.44 731.9 1554.17 688.63 1597.44 688.63"/>
<polygon class="cluster-4 fill" points="1554.17 645.37 1554.17 688.63 1510.91 645.37 1554.17 602.11 1554.17 645.37"/>
<polygon class="cluster-4 fill" points="1510.91 602.1 1467.64 602.1 1510.91 558.84 1554.17 602.1 1510.91 602.1"/>
<polygon class="cluster-4 fill" points="1467.65 645.37 1467.65 688.63 1424.38 645.37 1467.65 602.11 1467.65 645.37"/>
<polygon class="cluster-5 fill" points="1467.65 558.84 1467.65 602.11 1424.38 558.84 1467.65 515.58 1467.65 558.84"/>
<polygon class="cluster-5 fill" points="1467.65 472.31 1510.91 472.31 1467.65 515.58 1424.38 472.31 1467.65 472.31"/>
<polygon class="cluster-5 fill" points="1381.12 472.31 1337.85 472.31 1381.12 429.05 1424.38 472.31 1381.12 472.31"/>
<polygon class="cluster-5 fill" points="1337.85 429.05 1337.85 385.79 1381.12 429.05 1337.85 472.31 1337.85 429.05"/>
</g>
</svg>
<div id="speakerInfo">
<span class="name">Shelley Vohr</span>
<span class="topic">API Modernization: Building Bridges As You Cross Them</span>
</div>
<div id="silhouette"></div>
<div id="presentation"></div>
</div>
<script>
clusters = readClusters()
console.log(clusters);
show()
// show up currentcluster
// increase cluster id
// settimeout
//
</script>
</body>
</html>