为博客添加宠物

(想不想在你的博客放兹小宠物^_^)

(不多说,上)

安装依赖包,在站点根目录,打开Git Bash ,安装hexo-helper-live2d

1
npm install --save hexo-helper-live2d

站点配置文件或者主题配置文件添加以下内容(我推荐在站点配置文件,因为比较好找)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
live2d:
enable: true
scriptFrom: local
pluginRootPath: live2dw/
pluginJsPath: lib/
pluginModelPath: assets/
model:
use: live2d-widget-model-haruto //这里是你选择的宠物包
display:
position: right
width: 150
height: 300
mobile:
show: true

安装需要的宠物文件

1
npm install {packagename}

如效果图所示的宠物名为haruto, 则为 npm install live2d-widget-model-haruto,其他宠物包点击live2d-widget-models。如果需要修改宠物的位置,可以在display下添加

1
2
3
4
# 水平位置
hOffset: 0
# 垂直位置
vOffset: -20

(后期如果我还记得话会依依把库里的小宠物的图片放上来)