live2d放入hexo系 blog

下载你喜欢的Live2D模型

将包解压后丢到node_modules里面

执行下面两句。
npm uninstall hexo-helper-live2d
npm install –save hexo-helper-live2d

在hexo(不是主题内的config)内的config.yml内添加下面的代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##live2d config in blog
live2d:
enable: true
scriptFrom: local
pluginRootPath: live2dw/
pluginJsPath: lib/
pluginModelPath: assets/ #以上都是生成后的目录,随便你设定
tagMode: false
debug: false
model:
use: live2d-widget-model-hijiki #这里写你node_modules内live2d的包名。或者以下三种形式都可以。
# use: wanko # 博客根目录/live2d_models/ 下的目录名
# use: ./wives/wanko # 相对于博客根目录的路径
# use: https://cdn.jsdelivr.net/npm/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json
# 你的自定义 url
display:
position: right
width: 150
height: 300
mobile:
show: false
react:
opacity: 0.7

修改上面两个就好了,然后再deploy就ok。
当然要注意一下,这个用的是pose不是physics,如果是其他系统下的live2d用physics就要自己改一下physics内的变量命名了。