其他分享
首页 > 其他分享> > 用html代码给网页加个live2d看板娘吧

用html代码给网页加个live2d看板娘吧

作者:互联网

直接粘贴以下代码(静态网页在_config.yml中添加,博客园在页尾html中加):

              <link
                rel="stylesheet"
                href="https://cdn.jsdelivr.net/gh/Dreamer-Paul/Pio@2.4/static/pio.min.css"
              />
              <script
                async="async"
                src="https://cdn.jsdelivr.net/combine/gh/Dreamer-Paul/Pio@2.4/static/l2d.min.js,gh/Dreamer-Paul/Pio@2.4/static/pio.min.js"
                onl oad='
                  let pio_container = document.createElement("div");
                  pio_container.classList.add("pio-container");
                  pio_container.classList.add("right");
                  pio_container.style.bottom = "-2rem";
                  pio_container.style.zIndex = "1";
                  document.body.insertAdjacentElement("beforeend", pio_container);
                  let pio_action = document.createElement("div");
                  pio_action.classList.add("pio-action");
                  pio_container.insertAdjacentElement("beforeend", pio_action);
                  let pio_canvas = document.createElement("canvas");
                  pio_canvas.id = "pio";
                  pio_canvas.style.width = "14rem";
                  pio_canvas.width = "600";
                  pio_canvas.height = "800";
                  pio_container.insertAdjacentElement("beforeend", pio_canvas);
                  let pio = new Paul_Pio({
                    "mode": "fixed",
                    "hidden": true,
                    "content": {
                      "link": ["https:\/\/AbnerHung.github.io"],
                      "skin": ["要换成我的朋友吗?", "让她放个假吧~"],
                      "hidden": true,
                    },
                    "model": [
                      "https:\/\/cdn.jsdelivr.net/gh/xiaoski/live2d_models_collection/mikoto/mikoto.model.json",
                      "https:\/\/cdn.jsdelivr.net/gh/imuncle/live2d/model/tororo/tororo.model.json",
                      "https:\/\/cdn.jsdelivr.net/gh/imuncle/live2d/model/platelet-2/model.json",
                      "https:\/\/cdn.jsdelivr.net/gh/imuncle/live2d/model/xiaomai/xiaomai.model.json",
                      "https:\/\/cdn.jsdelivr.net/gh/imuncle/live2d/model/mashiro/seifuku.model.json",
                      "https:\/\/cdn.jsdelivr.net/gh/imuncle/live2d/model/Violet/14.json",
                      "https:\/\/cdn.jsdelivr.net/gh/xiaoski/live2d_models_collection/Kobayaxi/Kobayaxi.model.json",
                      "https:\/\/cdn.jsdelivr.net/gh/xiaoski/live2d_models_collection/uiharu/uiharu.model.json"
                      ]
                  });'
              ></script>

模型以及js代码来源于网络~

标签:看板娘,网页,代码,js,live2d,html
来源: https://www.cnblogs.com/AbnerHung/p/14719681.html