-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdev.html
80 lines (66 loc) · 2.37 KB
/
dev.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Live2d Test Env</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
* {
font-family: Merriweather, Arial, sans-serif;
letter-spacing: 0.1rem;
}
.content {
text-align: center;
padding: 10px 0px 20px;
}
.title {
color: rgb(34, 34, 34);
text-align: center;
padding: 10px 10px;
}
@media screen and (max-width: 320px) {
.forkMe {
display: none;
}
}
</style>
</head>
<body>
<a class="forkMe" style="position:fixed;z-index:999;top:0;right:0.5em"
href="https://github.com/JoeyBling/live2d-widget.js" target="_blank">
<img width="149" height="149" src="./images/forkme.png" class="attachment-full size-full" alt="Fork me on GitHub"
data-recalc-dims="1">
</a>
<div class="content">
<input class="title" type="button" value="保存为图片" id="savePng" />
<input class="title" type="button" value="live2d模型包展示" onclick="javascript:location.href='./examples/index.html'" />
</div>
</body>
<script src="lib/L2Dwidget.min.js"></script>
<script src="lib/live2d.js"></script>
<script type="text/javascript">
// 所有模型集合
var modelArray = ["chitose", "epsilon2_1", "gf", "haru/01", "haru/02", "haruto", "hibiki", "hijiki", "izumi",
"koharu", "miku", "nico", "nietzsche", "ni-j", "nipsilon", "nito", "shizuku", "tororo", "tsumiki", "unitychan",
"wanko", "z16"
];
var random = Math.floor((Math.random() * modelArray.length));
var randomModelName = modelArray.slice(random, random + 1)[0];
console.log("随机获取到的模型:" + randomModelName);
// modelName 对应 live2d_models 名称
Live2D.init(randomModelName);
document.getElementById("savePng").onclick = function () {
console.log(L2Dwidget.config);
L2Dwidget.downloadFrame(); // 将当前帧捕获到png文件并下载
};
</script>
<script>
// 根据链接地址的不同,更换forkMe的图标和地址
var hrefValue = window.location.href;
if (String(hrefValue).indexOf('gitee.io') >= 0) {
document.getElementsByClassName("attachment-full")[0].src = "./images/gitee.svg";
document.getElementsByClassName("forkMe")[0].href = "https://gitee.com/zhousiwei/live2d-widget.js";
}
</script>
</html>