-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
mode.html
236 lines (206 loc) · 5.32 KB
/
mode.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Live2D Background Example</title>
<!-- Live2D SDK -->
<script src="https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/pixi.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pixi-live2d-display/dist/index.min.js"></script>
<link rel="stylesheet" href="styles.css">
<!-- Custom CSS -->
<style>
body, html {
margin: 0;
padding: 0;
overflow: hidden;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #f0f0f0;
position: relative;
}
body{
background: #3399ff;
}
.circle{
position: absolute;
border-radius: 50%;
background: white;
animation: ripple 15s infinite;
box-shadow: 0px 0px 1px 0px #508fb9;
}
.small{
width: 200px;
height: 200px;
left: -100px;
bottom: -100px;
}
.medium{
width: 400px;
height: 400px;
left: -200px;
bottom: -200px;
}
.large{
width: 600px;
height: 600px;
left: -300px;
bottom: -300px;
}
.xlarge{
width: 800px;
height: 800px;
left: -400px;
bottom: -400px;
}
.xxlarge{
width: 1000px;
height: 1000px;
left: -500px;
bottom: -500px;
}
.shade1{
opacity: 0.2;
}
.shade2{
opacity: 0.5;
}
.shade3{
opacity: 0.7;
}
.shade4{
opacity: 0.8;
}
.shade5{
opacity: 0.9;
}
@keyframes ripple{
0%{
transform: scale(0.8);
}
50%{
transform: scale(1.2);
}
100%{
transform: scale(0.8);
}
}
#canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.content {
position: absolute;
z-index: 2;
text-align: center;
color: #000;
font-family: Arial, sans-serif;
}
.content h1 {
font-size: 3em;
margin-bottom: 10px;
}
.content p {
font-size: 1.5em;
}
.content img {
max-width: 150px;
height: auto;
margin-top: 20px;
}
</style>
</head>
<body>
<div class='ripple-background'>
<div class='circle xxlarge shade1'></div>
<div class='circle xlarge shade2'></div>
<div class='circle large shade3'></div>
<div class='circle mediun shade4'></div>
<div class='circle small shade5'></div>
</div>
<!-- Live2D Canvas -->
<canvas id="canvas"></canvas>
<!-- Front Elements -->
<div class="content">
<div class="container">
<div class="profile-card">
<div class="profile-header">
<h2>Dr. 安克赫娜单推人 #6599</h2>
<p>年度称号 (Title of the Year)</p>
<div class="titles">
<button class="title-btn">摸鱼的</button>
<button class="title-btn">坍缩体</button>
</div>
</div>
<!-- Background box and profile image -->
<div class="image-container">
<div class="background-box"></div>
<div class="profile-image">
<img src="pp.jpg" alt="Arknights Character">
</div>
</div>
<div class="profile-footer">
<h3>年度关键词 (Keywords of the Year)</h3>
<div class="keywords">
<span>与蜜蝎相互信赖</span>
<span>踏足冰原的冒险家</span>
<span>通晓萨米预言之人</span>
</div>
</div>
</div>
</div>
</div>
<!-- Live2D Script -->
<script>
const cubism2Model =
"https://live2d.nekochan.eu.org/Hotaru/hotaru_keyvisual.model3.json";
const live2d = PIXI.live2d;
(async function main() {
const app = new PIXI.Application({
view: document.getElementById("canvas"),
autoStart: true,
resizeTo: window,
transparent: true
});
const model = await live2d.Live2DModel.from(cubism2Model);
app.stage.addChild(model);
// Fungsi untuk menyesuaikan ukuran model sesuai dengan lebar layar
function resizeModel() {
const screenWidth = window.innerWidth;
if (screenWidth > 1024) {
// Desktop: perbesar model
const scaleX = (innerWidth * 0.6) / model.width;
const scaleY = (innerHeight * 1.2) / model.height;
model.scale.set(Math.min(scaleX, scaleY));
model.y = innerHeight * 0.1; // Posisi vertikal di desktop
} else if (screenWidth > 768 && screenWidth <= 1024) {
// Tablet: sesuaikan skala model
const scaleX = (innerWidth * 0.8) / model.width;
const scaleY = (innerHeight * 1.0) / model.height;
model.scale.set(Math.min(scaleX, scaleY));
model.y = innerHeight * 0.1; // Posisi vertikal di tablet
} else {
// Mobile: perkecil model agar sesuai layar
const scaleX = (innerWidth * 0.9) / model.width;
const scaleY = (innerHeight * 1.9) / model.height;
model.scale.set(Math.min(scaleX, scaleY));
model.y = innerHeight * 0.5; // Posisi vertikal di ponsel
}
}
// Panggil fungsi resize saat aplikasi dimulai
resizeModel();
// Menyesuaikan model setiap kali ukuran jendela diubah
window.addEventListener("resize", resizeModel);
})();
</script>
</body>
</html>