Skip to content

Commit 86b1755

Browse files
committed
black screen opening
1 parent 493c128 commit 86b1755

File tree

3 files changed

+41
-22
lines changed

3 files changed

+41
-22
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<meta charset="utf-8" />
1212
</head>
1313
<body>
14+
<div id="black-overlay"></div>
1415
<main id="canvas-container"></main>
1516
<script src="sketch.js"></script>
1617
<!-- <img id="overlay-image" src="lib/padding-reference.png" alt="Calibration Overlay"> -->

sketch.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ let lyricDiv;
33
let currentLyric = '';
44
let lyrics =
55
[
6-
{
7-
"text": " ",
8-
"beats": 24
9-
},
6+
// {
7+
// "text": " ",
8+
// "beats": 24
9+
// },
1010
{
1111
"text": "黒塗り<br>世界宛て<br>書簡",
12-
"beats": 32
12+
"beats": 56
1313
},
1414
{
1515
"text": "██████",
@@ -24,7 +24,7 @@ let lyrics =
2424
"beats": 16
2525
},
2626
{
27-
"text": "そしてクオリアを<br>持った████<br>として蘇り",
27+
"text": "そしてクオリアを<br>持った████<br>として蘇り", //8+8
2828
"beats": 16
2929
},
3030
{
@@ -56,12 +56,8 @@ let lyrics =
5656
"beats": 2
5757
},
5858
{
59-
"text": "█後2週間",
60-
"beats": 4
61-
},
62-
{
63-
"text": "█後2週間<br>███かけた<br>身体が目を覚まし",
64-
"beats": 12
59+
"text": "█後2週間<br>███かけた<br>身体が目を覚まし", //4+10
60+
"beats": 14,
6561
},
6662
{
6763
"text": "液化したピアノと<br>夜を<br>明かす",
@@ -80,31 +76,31 @@ let lyrics =
8076
"beats": 16
8177
},
8278
{
83-
"text": "█ぬも█むも<br>██いも<br>█くも愛す",
79+
"text": "█ぬも█むも<br>██いも<br>█くも愛す", //每个都间隔2拍
8480
"beats": 8
8581
},
8682
{
87-
"text": "█かれた<br>█違いの<br>██の詩",
83+
"text": "█かれた<br>█違いの<br>██の詩", //每个都间隔2拍
8884
"beats": 8
8985
},
9086
{
91-
"text": "██に<br>█き██され<br>█った言葉を",
87+
"text": "██に<br>█き██され<br>█った言葉を", //每个都间隔2拍
9288
"beats": 8
9389
},
9490
{
95-
"text": "██った<br>█れ者が<br>██してく",
91+
"text": "██った<br>█れ者が<br>██してく", //每个都间隔2拍
9692
"beats": 8
9793
},
9894
{
99-
"text": "██以外<br>█んで██った<br>██溜めで",
95+
"text": "██以外<br>█んで██った<br>██溜めで", //每个都间隔2拍
10096
"beats": 8
10197
},
10298
{
103-
"text": "██も██も<br>██も<br>伝えられなきゃ",
99+
"text": "██も██も<br>██も<br>伝えられなきゃ", //每个都间隔2拍
104100
"beats": 8
105101
},
106102
{
107-
"text": "█んでも<br>█んでも<br>██きれないから",
103+
"text": "█んでも<br>█んでも<br>██きれないから", //每个都间隔2拍
108104
"beats": 8
109105
},
110106
{
@@ -129,6 +125,8 @@ let bpm = 185;
129125
let beatDuration = 60 / bpm;
130126
let totalBeatsElapsed = 0;
131127

128+
let overlayRemoved = false; // 避免多次移除遮罩
129+
132130
function setup() {
133131
audioEl = createAudio('https://raw.githubusercontent.com/n3xta/image-hosting/main/audio/letter_to_the_black_world.mp3');
134132
audioEl.showControls();
@@ -150,6 +148,12 @@ function updateLyrics() {
150148
let currentTime = audioEl.time();
151149
let totalBeats = Math.floor(currentTime / beatDuration);
152150

151+
if (totalBeats >= 23 && !overlayRemoved) { //考虑这边改一下时机
152+
const overlay = document.getElementById('black-overlay');
153+
overlay.remove();
154+
overlayRemoved = true;
155+
}
156+
153157
let accumulatedBeats = 0;
154158
for (let i = 0; i < lyrics.length; i++) {
155159
accumulatedBeats += lyrics[i].beats;
@@ -160,7 +164,6 @@ function updateLyrics() {
160164
}
161165
}
162166

163-
164167
// function showLyric(lyric) {
165168
// if (lyric !== currentLyric) {
166169
// currentLyric = lyric;

style.css

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ body, html {
2727

2828
div {
2929
position: absolute;
30-
top: 14.9vh;
30+
/* top: 14.9vh; */
31+
top: 7.6vw;
3132
left: 7vw;
3233
font-size: 9.43vw;
33-
line-height: 22.2vh; /* or 165 px*/
34+
/* line-height: 22.2vh; */
35+
line-height: 11.25vw; /* or 165 px*/
3436
letter-spacing: -0.3vw;
3537
font-family: "Noto Sans JP", sans-serif;
3638
font-weight: 700;
@@ -72,3 +74,16 @@ span.block {
7274
color: transparent;
7375
font-size: 7.2vw;
7476
}
77+
78+
#black-overlay {
79+
position: fixed;
80+
top: 0;
81+
left: 0;
82+
width: 100%;
83+
height: 100%;
84+
background-color: black;
85+
opacity: 1;
86+
z-index: 50;
87+
transition: opacity 1s ease;
88+
pointer-events: none; /* 避免干扰点击事件 */
89+
}

0 commit comments

Comments
 (0)