添加live2d看板娘,插件:hexo-helper-live2d,github倉庫:https://github.com/EYHN/hexo-helper-live2d
右下角:可愛小黑貓🐱
安裝
1.安裝插件
運行命令npm install --save hexo-helper-live2d
$ npm install --save hexo-helper-live2d
> [email protected] postinstall H:\Hexo\node_modules\babel-polyfill\node_modules\core-js
> node postinstall || echo "ignore"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> [email protected] postinstall H:\Hexo\node_modules\babel-runtime\node_modules\core-js
> node postinstall || echo "ignore"
> [email protected] postinstall H:\Hexo\node_modules\live2d-widget
> opencollective-postinstall
Thank you for using live2d-widget!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/live2d-widgetjs/donate
> [email protected] postinstall H:\Hexo\node_modules\hexo-helper-live2d
> opencollective-postinstall
Thank you for using hexo-helper-live2d!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/hexo-helper-live2d/donate
npm WARN [email protected] requires a peer of eslint@>= 4.12.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
added 277 packages from 109 contributors and audited 25235 packages in 255.268s
found 20 vulnerabilities (7 low, 6 moderate, 6 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
2.選擇模型
可到https://huaji8.top/post/live2d-plugin-2.0/預覽效果。
命令爲:npm install live2d-widget-model-模型名
,模型爲可參考上面的預覽內容。
安裝模型:
$ npm install live2d-widget-model-hijiki
npm WARN [email protected] requires a peer of eslint@>= 4.12.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
added 1 package in 52.155s
3.配置
站點的配置文件\_config.yml
或者是主題的配置文件中添加:
# Live2D
## https://github.com/EYHN/hexo-helper-live2d
live2d:
enable: true
scriptFrom: local
pluginRootPath: live2dw/
pluginJsPath: lib/
pluginModelPath: assets/
tagMode: false
debug: false
model:
use: live2d-widget-model-hijiki # 模型:https://huaji8.top/post/live2d-plugin-2.0/
display:
position: right
width: 150
height: 300
mobile:
show: true
注意這裏的use
參數是上面安裝的那個模型全名。
4.效果圖
可愛的小黑貓已上線(見封面)。如果不起效,一般需要重新生成hexo clean & hexo g
。
補充
- 添加動畫一般都會比較耗內存,請自行選擇是否添加。
- 魔改版:在網頁中添加Live2D看板娘,基於next主題。,github:https://github.com/stevenjoezhang/live2d-widget
- 魔改2:https://www.fghrsh.net/post/123.html
取消看板娘
暫時不用
將配置中的enable
設置成false即可。
卸載插件
運行命令下載插件,刪除配置信息:
- 卸載模型:
npm install live2d-widget-model-模型名
- 卸載live2d插件:
npm uninstall hexo-helper-live2d
- 去掉站點
_config.yml
下的配置信息即可。
文章首發於:hexo+yilia添加live2d看板娘