先把文件建好,一共四个需要上传博客园的文件
①waifu.css ②waifu-tip.css ③live2d.js ④live2d-related.css
你可以通过https://blog-static.cnblogs.com/files/Nortonary/ + 相应文件名 获取该文件的详细代码
随后,在博客园侧边公告栏输入以下代码:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Live2D</title> <link rel="stylesheet" type="text/css" href="https://files.cnblogs.com/files/Nortonary/waifu.css"/>
<link rel="stylesheet" type="text/css" href="https://files.cnblogs.com/files/Nortonary/live2d-related.css"/> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> </head> <body> <div class="waifu" id="waifu"> <div class="waifu-tips" style="opacity: 1;"></div> <canvas id="live2d" width="350" height="330" class="live2d"></canvas> <div class="waifu-tool"> <span class="fui-home"></span> <span class="fui-chat"></span> <span class="fui-eye"></span> <span class="fui-user"></span> <span class="fui-photo"></span> </div> </div> <script src="https://files.cnblogs.com/files/Nortonary/live2d.js"></script> <script src="https://files.cnblogs.com/files/Nortonary/waifu-tips.js"></script> <script type="text/javascript">initModel()</script> </body> </html>
注意两点:
①以上代码的文件均从我的博客文件中引用,方便,但是想自己做还是下载一份好
②博客园的侧边公告栏需要申请 js 权限才能使用以上代码