forked from raoenhui/live2d-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex2.html
More file actions
232 lines (207 loc) · 5.52 KB
/
index2.html
File metadata and controls
232 lines (207 loc) · 5.52 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
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
<!DOCTYPE html>
<!-- saved from url=(0033)https://l2dwidget.js.org/dev.html -->
<html class="ios iphone mobile portrait">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>看板娘</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.live2d-widget-dialog-container {
width: 300px;
height: 120px;
position: absolute;
bottom: 65%;
right: 0px;
transform-origin: right;
padding: 12px;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
.live2d-widget-dialog {
width: 100%;
height: 100%;
color: #917159;
font-size: 16px;
padding: 12px;
border: 2px solid rgb(236, 203, 180);
background: rgb(252, 248, 244);
box-sizing: border-box;
border-radius: 10px;
transform: rotate(-2deg);
opacity: 0;
transition: 200ms opacity;
box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px;
animation: live2d-widget-dialog-tingle 4s ease-in-out 0s infinite alternate;
}
@keyframes live2d-widget-dialog-tingle {
0% { transform: translate(-1px, 1.5px) rotate(-2deg); }
100% { transform: translate(1px, -1.5px) rotate(2deg); }
}
</style>
<meta name="chromesniffer" id="chromesniffer_meta" content="{"SPDY":-1}">
<script type="text/javascript" src="chrome-extension://fhhdlnnepfjhlhilgmeepgkhjmhhhjkh/js/detector.js"></script>
</head>
<body>
<p>试试摸摸头和这颗星星会有不同的对话哦</p>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="190" height="180" class="star">
<polygon points="100,0 160,180 10,60 190,60 40,180" style="fill:yellow;stroke:yellow;stroke-width:1;"></polygon>
</svg>
<script src="./src/L2Dwidget.min.js"></script>
<script type="text/javascript">
L2Dwidget
.on('*', (name) => {
console.log('%c EVENT ' + '%c -> ' + name, 'background: #222; color: yellow', 'background: #fff; color: #000')
})
.init({
dialog: {
// 开启对话框
enable: true,
script: {
// 每空闲 10 秒钟,显示一条一言
'every idle 10s': '$hitokoto$',
// 当触摸到星星图案
'hover .star': '星星在天上而你在我心里 (*/ω\*)',
// 当触摸到角色身体
'tap body': '哎呀!别碰我!',
// 当触摸到角色头部
'tap face': '人家已经不是小孩子了!'
}
}
});
</script>
<div id="live2d-widget" class="live2d-widget-container" style="position: fixed; right: 0px; bottom: -20px; width: 200px; height: 400px; z-index: 99999; opacity: 1; pointer-events: none;">
<div class="live2d-widget-dialog-container" style="transform: scale(0.8);">
<div class="live2d-widget-dialog" style="opacity: 0;">我,将某个人,唯一的某个人,试图锁定。我,</div>
</div><canvas id="live2dcanvas" width="400" height="800" style="position: absolute; left: 0px; top: 0px; width: 200px; height: 400px;"></canvas>
</div>
</body>
<style type="text/css">
#yddContainer {
display: block;
font-family: Microsoft YaHei;
position: relative;
width: 100%;
height: 100%;
top: -4px;
left: -4px;
font-size: 12px;
border: 1px solid
}
#yddTop {
display: block;
height: 22px
}
#yddTopBorderlr {
display: block;
position: static;
height: 17px;
padding: 2px 28px;
line-height: 17px;
font-size: 12px;
color: #5079bb;
font-weight: bold;
border-style: none solid;
border-width: 1px
}
#yddTopBorderlr .ydd-sp {
position: absolute;
top: 2px;
height: 0;
overflow: hidden
}
.ydd-icon {
left: 5px;
width: 17px;
padding: 0px 0px 0px 0px;
padding-top: 17px;
background-position: -16px -44px
}
.ydd-close {
right: 5px;
width: 16px;
padding-top: 16px;
background-position: left -44px
}
#yddKeyTitle {
float: left;
text-decoration: none
}
#yddMiddle {
display: block;
margin-bottom: 10px
}
.ydd-tabs {
display: block;
margin: 5px 0;
padding: 0 5px;
height: 18px;
border-bottom: 1px solid
}
.ydd-tab {
display: block;
float: left;
height: 18px;
margin: 0 5px -1px 0;
padding: 0 4px;
line-height: 18px;
border: 1px solid;
border-bottom: none
}
.ydd-trans-container {
display: block;
line-height: 160%
}
.ydd-trans-container a {
text-decoration: none;
}
#yddBottom {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 22px;
line-height: 22px;
overflow: hidden;
background-position: left -22px
}
.ydd-padding010 {
padding: 0 10px
}
#yddWrapper {
color: #252525;
z-index: 10001;
background: url(chrome-extension://eopjamdnofihpioajgfdikhhbobonhbb/ab20.png);
}
#yddContainer {
background: #fff;
border-color: #4b7598
}
#yddTopBorderlr {
border-color: #f0f8fc
}
#yddWrapper .ydd-sp {
background-image: url(chrome-extension://eopjamdnofihpioajgfdikhhbobonhbb/ydd-sprite.png)
}
#yddWrapper a,
#yddWrapper a:hover,
#yddWrapper a:visited {
color: #50799b
}
#yddWrapper .ydd-tabs {
color: #959595
}
.ydd-tabs,
.ydd-tab {
background: #fff;
border-color: #d5e7f3
}
#yddBottom {
color: #363636
}
#yddWrapper {
min-width: 250px;
max-width: 400px;
}
</style>
</html>