mirror of
https://github.com/Buriburizaem0n/live2d.git
synced 2026-02-04 03:20:02 +00:00
new autoload.js
This commit is contained in:
8
live2d/dist/auto.js
vendored
8
live2d/dist/auto.js
vendored
@@ -1,9 +1,10 @@
|
||||
const live2d_path = "https://www.luoyangdonghui.de/wp-content/uploads/live2d_test34/live2d/";
|
||||
const live2d_path = "https://www.luoyangdonghui.de/wp-content/uploads/live2d_test35/live2d/";
|
||||
|
||||
//封装异步加载资源的方法
|
||||
function loadExternalResource(url, type) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let tag;
|
||||
|
||||
if (type === "css") {
|
||||
tag = document.createElement("link");
|
||||
tag.rel = "stylesheet";
|
||||
@@ -13,6 +14,7 @@ function loadExternalResource(url, type) {
|
||||
tag.src = url;
|
||||
tag.async = true; // 确保脚本是异步加载的
|
||||
}
|
||||
|
||||
if (tag) {
|
||||
tag.onload = () => {
|
||||
resolve(`Resource loaded: ${url}`);
|
||||
@@ -34,7 +36,7 @@ function loadExternalResource(url, type) {
|
||||
});
|
||||
}
|
||||
|
||||
if (screen.width >= 768) {
|
||||
if (screen.width >= 600) {
|
||||
Promise.all([
|
||||
loadExternalResource(live2d_path + "waifu.css", "css"),
|
||||
loadExternalResource(live2d_path + "live2d.min.js", "js"),
|
||||
@@ -45,6 +47,7 @@ if (screen.width >= 768) {
|
||||
]).then(() => {
|
||||
loadExternalResource("https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js", "js");
|
||||
});
|
||||
|
||||
ap = null;
|
||||
Object.defineProperty(document.querySelector('meting-js'), "aplayer", {
|
||||
set: function (aplayer) {
|
||||
@@ -54,6 +57,7 @@ if (screen.width >= 768) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`
|
||||
く__,.ヘヽ. / ,ー、 〉
|
||||
\ ', !-─‐-i / /´
|
||||
|
||||
Reference in New Issue
Block a user