-
Notifications
You must be signed in to change notification settings - Fork 1
/
psychometry.html
369 lines (341 loc) · 11.6 KB
/
psychometry.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="心理测验:猜猜我是哪只狗?">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
<link rel="icon" href="cssc/psychometry/MicroDogInstdrv.ico" type="image/x-icon" />
<link rel="shortcut icon" href="cssc/psychometry/MicroDogInstdrv.ico" type="image/x-icon" />
<title>慢着点,别急!</title>
<script src="https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js"></script>
<style>
@import url(/basis/css/ease.css);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
}
body,
html {
overflow: hidden;
background-color: black;
}
#slide {
transform-origin: left top;
height: 100vh;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: var(--img-width);
height: var(--img-height);
}
.avoid-click {
pointer-events: none !important;
}
#title {
font-weight: 900;
position: absolute;
right: 0;
height: 100%;
writing-mode: vertical-rl;
text-align: center;
font-size: 64px;
padding: .5em;
background: linear-gradient(to left, #E0322D 25%, #A01C18 100%);
-webkit-background-clip: text;
-moz-background-clip: text;
-ms-background-clip: text;
-o-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-stroke: 1px white;
-moz-text-stroke: 1px white;
-ms-text-stroke: 1px white;
-o-text-stroke: 1px white;
/* text-stroke: 1px white; */
text-shadow: 0 -4px 6px rgb(0 0 0 / 35%);
}
#center-info {
width: 100%;
line-height: var(--img-height);
text-align: center;
color: #4A452A;
font-size: 96px;
transform: scale(1);
opacity: 1;
transition: all 1s var(--ease-out-circ);
font-family: Garamond, "方正幼线简体", "方正盛世楷书简体_粗", "方正盛世楷书简体", "楷体_GB2312", "楷体", "华文楷体";
text-shadow: 0 1px 0 #ccc,
0 2px 0 #c9c9c9,
0 3px 0 #bbb,
0 4px 0 #b9b9b9,
0 5px 0 #aaa,
0 6px 1px rgba(0, 0, 0, .1),
0 0 5px rgba(0, 0, 0, .1),
0 1px 3px rgba(0, 0, 0, .3),
0 3px 5px rgba(0, 0, 0, .2),
0 5px 10px rgba(0, 0, 0, .25),
0 10px 10px rgba(0, 0, 0, .2),
0 20px 20px rgba(0, 0, 0, .15),
0 0 20px white,
0 0 20px white,
0 0 20px white;
}
#center-info.hide {
transition: all 1s var(--ease-in-circ);
/* font-size: 0; */
transform: scale(0);
opacity: 0;
}
map {
/* display: none; */
cursor: pointer;
}
#top-warning {
--height: 50px;
position: absolute;
top: 0;
width: 100%;
padding: .13cm .25cm;
background-color: red;
color: white;
font-weight: 400;
line-height: var(--height);
transition: all 1s var(--ease-out-circ);
}
#top-warning.hide {
top: calc(-10px - var(--height));
transition: all 1s var(--ease-in-circ);
}
#unlock-bar {
--height: 128px;
background-color: rgba(255, 0, 0, 0.5);
position: absolute;
bottom: 0;
width: 100%;
height: var(--height);
/* box-sizing: content-box; */
background: linear-gradient(#5e5e5eee, #313131ee 50%, #1b1b1bf0 50%, #111111f0);
box-shadow: 0 -2px 0 0 #6c6c6cee, 0 -4px 0 0 #2a2a2aee, 0 -6px 0 0 #52525266;
padding: 28px;
transition: bottom 750ms var(--ease-out-expo);
}
#unlock-bar * {
width: 100%;
height: 100%;
border-radius: 15px;
}
#unlock-groove-border {
background: linear-gradient(#4a4a4af0, #6f6f6ff0);
padding: 1px;
}
#unlock-groove {
background: linear-gradient(#030303cc, #282828cc);
padding: 4px;
overflow: hidden;
}
#unlock-slider {
background: linear-gradient(white, #dedede 50%, #cfcfcf 50%, #a3a3a3);
border-radius: 12px;
width: 80px;
box-shadow: 0 1px 2px 0 black;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
position: relative;
}
/* #unlock-slider>* {
width: 58px;
height: 46px;
transform: scale(0.8);
pointer-events: none;
} */
#right-arrow {
width: 58px;
height: 46px;
transform: scale(0.8);
pointer-events: none;
clip-path: path("M1 14 30 14 30 2 56 23 30 44 30 32 1 32Z");
background: linear-gradient(#ccc, #aaa 50%, #888 50%, #5e5e5e);
/* border 或 box-shadow inset 弄不成了! */
}
#unlock-info {
color: rgb(93, 93, 93);
text-align: center;
position: absolute;
line-height: 65px;
font-size: 175%;
pointer-events: none;
left: 0;
}
#unlock-info>span {
--size: 400%;
background: linear-gradient(to right, rgb(93, 93, 93) 30%, rgb(177, 177, 177), rgb(93, 93, 93) 70%) left center / var(--size) var(--size);
animation: unlock-info-shine 3s infinite linear;
-webkit-background-clip: text;
-moz-background-clip: text;
-ms-background-clip: text;
-o-background-clip: text;
background-clip: text;
color: transparent;
border-radius: 0;
font-weight: 500;
font-family: "方正中等线简体", -apple-system, BlinkMacSystemFont, "苹方", "苹方-简", "苹方 中等", "苹方 常规", 'Helvetica Neue', sans-serif;
}
@keyframes unlock-info-shine {
from {
background-position-x: 100%;
}
to {
background-position-x: 0%;
}
}
.recovery {
left: 0 !important;
opacity: 1 !important;
transition: all 250ms var(--ease-out-cubic);
}
.finish {
filter: brightness(0.4) grayscale(1);
transition: all 500ms var(--ease-in-out-quint);
pointer-events: none;
}
#unlock-bar.hide {
bottom: calc(-10px - var(--height));
}
</style>
<!-- <style id="live-screen"></style> -->
</head>
<body hidden>
<div id="slide">
<img src="cssc/psychometry/黄狗.jpeg" alt="Three Golden Retrievers or Yellow Dogs" usemap="#dogs">
<map name="dogs" id="dogs">
<area shape="poly" coords="262,129,238,165,269,200,261,214,270,219,242,267,246,288,202,343,201,350,138,441,134,503,142,525,134,540,148,539,154,547,174,543,199,550,201,534,218,549,268,551,291,566,294,579,304,581,337,570,320,541,348,535,354,564,390,553,381,534,388,399,401,362,396,311,408,285,396,259,386,245,392,221,386,219,385,208,391,216,399,202,399,194,408,187,401,150,391,124,362,111,323,102,293,112" alt="1">
<area shape="poly" coords="440,150,475,196,444,241,442,265,400,341,398,365,381,532,418,545,428,539,461,548,463,556,469,558,481,568,498,555,504,557,486,513,497,502,531,516,536,559,574,563,580,559,566,533,562,501,574,375,579,364,588,341,589,302,595,286,589,270,592,269,573,236,583,208,583,180,592,195,601,200,598,175,611,146,584,97,538,89,487,96" alt="2">
<area shape="poly" coords="639,292,617,350,629,364,642,376,626,389,596,419,589,429,588,445,574,451,564,475,561,496,584,495,622,507,617,526,617,546,740,533,779,548,796,551,792,547,798,543,799,536,793,528,786,515,776,479,781,424,757,378,758,371,760,371,767,350,773,348,771,334,777,330,766,321,758,291,735,286,709,276,694,275,656,287" alt="3">
</map>
</div>
<div class="overlay avoid-click">
<h1 id="title">心理测验,猜猜我是哪只狗?</h1>
<h1 id="center-info" class="hide">害怕</h1>
<h1 id="top-warning" class="hide">很抱歉,你答错了。</h1>
</div>
<div class="overlay avoid-click" style="overflow: hidden;">
<div id="unlock-bar" class="hide">
<div id="unlock-groove-border">
<div id="unlock-groove">
<div id="unlock-info">
<span>滑动来解锁</span>
</div>
<div id="unlock-slider">
<div id="right-arrow"></div>
<!-- <embed src="cssc/psychometry/right_arrow.svg" type="image/svg+xml"> -->
</div>
</div>
</div>
</div>
</div>
<!-- <script id="debug-only">
document.getElementById("slide").style.justifyContent = "left";
var coords = [];
window.onclick = function(e) {
coords.push(e.pageX);
coords.push(e.pageY);
console.log(coords.join(','));
}
</script> -->
<script>
document.querySelectorAll("#dogs area").forEach(area => area.setAttribute("onclick", `operate(${area.alt});`));
onresize = function () {
const img = document.querySelector("#slide img"),
imgBox = document.querySelector("#slide"),
imgWidth = img.width,
imgHeight = img.height,
scaleX = innerWidth / imgWidth,
scaleY = innerHeight / imgHeight,
scaleHeight = imgHeight * scaleX,
condition = (scaleHeight > innerHeight),
root = document.documentElement.style; // document.documentElement.style.setProperty; --> 这是在想桃子?
imgBox.style.transform = `scale(${scaleX + (condition ? ',' + scaleY : '')})`;
root.setProperty("--img-width", innerWidth + "px");
root.setProperty("--img-height", (condition ? innerHeight : scaleHeight) + "px");
}
onload = function () {
onresize();
document.body.hidden = false;
}
function showCenterInfo(text) {
showMessage(document.getElementById("center-info"), text);
}
function showTopWarning(text, hideLater = true) {
showMessage(document.getElementById("top-warning"), text, hideLater);
}
function showMessage(el = console.error(Error()), text, hideLater = true) {
el.innerText = text;
el.classList.remove("hide");
if (hideLater) setTimeout(() => el.classList.add("hide"), 1000);
}
function showUnlockBar() {
document.getElementById("unlock-bar").classList.remove("hide");
document.getElementsByClassName("overlay")[1].classList.remove("avoid-click");
console.log("恭喜你找到了周事狗");
}
function operate(num) {
const slide = document.getElementById("slide"),
expression = ["害怕", "恐惧", "乐观"],
expressionEn = ["fear", "scared", "optimistic"];
slide.classList.add("avoid-click");
bark[expressionEn[num - 1]].play();
showCenterInfo(expression[num - 1]);
setTimeout(() => {
num != 3 ? showTopWarning("很抱歉,你答错了。") : showTopWarning("恭喜你找到了黄狗!", false);
num == 3 ? showUnlockBar() : 0;
}, 2000);
setTimeout(() => slide.classList.remove("avoid-click"), 4000);
}
var bark = {
fear: new Audio("cssc/psychometry/6593.wav"),
scared: new Audio("cssc/psychometry/8268.wav"),
optimistic: new Audio("cssc/psychometry/8304.wav")
}
{
const unlockSlider = document.getElementById("unlock-slider"),
unlockInfo = document.getElementById("unlock-info");
let unlockSliderLeft = /* unlockSlider.offsetLeft */ 73;
unlockSlider.onpointerdown = function (e) {
ontouchmove = onmousemove = function (e) {
// console.log(e);
const Left = e.clientX || e.touches[0].clientX,
Right = innerWidth - 2 * unlockSliderLeft;
let left = Left - unlockSliderLeft;
if (left < 0) left = 0;
if (left > Right) left = Right;
unlockSlider.style.left = left + 'px';
unlockInfo.style.opacity = (1 - left / Right) ** 3;
}
}
ontouchend = onpointerup = function (e) {
ontouchmove = onmousemove = null;
const OK_percent = 0.9;
if (parseInt(unlockSlider.style.left) + unlockSliderLeft > OK_percent * innerWidth) {
// unlockSlider.style.left = innerWidth - unlockSliderLeft / 2 - unlockSlider.clientWidth + "px";
alert("键盘已解锁!");
setTimeout(() => location.href = "option.html", 350);
return document.body.classList.add("finish");
}
const el = [unlockSlider, unlockInfo];
el.forEach(i => {
i.classList.add("recovery");
i.style.cssText = '';
});
setTimeout(() => el.forEach(i => i.classList.remove("recovery")), 350);
}
}
</script>
</body>
</html>