Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 47 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,67 @@
# vue-live2d
# 由vue-live2d扩容后的vue-live2d

[![version](https://img.shields.io/npm/v/vue-live2d)](https://npm.js) ![license](https://img.shields.io/github/license/evgo2017/vue-live2d) [![downloads](https://img.shields.io/npm/dt/vue-live2d)](<https://www.npmjs.com/package/vue-live2d> ) [![fork](https://img.shields.io/github/forks/evgo2017/vue-live2d?style=social)](https://github.com/evgo2017/vue-live2d)

vue 看板娘

![logo](https://github.com/evgo2017/vue-live2d/blob/master/public/logo.png)

可直接在 vue 项目中直接引用此包,即可应用看板娘,目前包含不少功能配置。
### 新增内容
新增76种live2d模型

## 一、使用
新增3种一言接口(包含古诗词)

### 1. 在线浏览
新增根据模型调整高度(弃用逻辑实力不足),替代方案为引入四个按钮,可自定义调整高度

#### 个人网站应用

访问速度快:
## 一.项目中引用
参考demo: [https://raxcl.cn](https://raxcl.cn/home)

https://evgo2017.com/repo/vue-live2d
参考代码库: [https://github.com/Raxcl/RBlog](https://github.com/Raxcl/RBlog)

#### 使用示例
代码路径:src/component/live2d

部署在 github 上:

https://evgo2017.github.io/vue-live2d/page/index.html

### 2. 项目引入
### 1. 将live2d文件夹放入自己项目的component文件夹下

### 2. 在view文件夹下的index.vue(需根据项目具体情况做出调整)中引入live2d
```
npm install vue-live2d
<!-- 引入live2d 看板娘 -->
import Live2d from '@/components/live2d/live2d'

// 在组件中引入
import vueLive2d from 'vue-live2d'
<!-- 使用live2d 看板娘 -->
<Live2d/>
```

// 组件中的使用方法具体参考 `example/App.vue` 文件
### 3. 安装诗词一言插件
```
npm install jinrishici(应该是这个命令,具体项目启动后缺少插件也会提示安装)
npm install --save font-awesome (安装图标库)
```
### 3. 本地浏览

其中包含源码,`example/App.vue` 为使用示例。
## 二. live2d看板娘维护
### 1. fork本项目,然后vscode或者其他编译器打开

### 2. 运行
```
$ git clone https://github.com/evgo2017/vue-live2d.git
$ cd ./vue-live2d
$ npm install
$ npm run serve
npm install

npm run serve
```

## 二、配置参数
### 3. 对src下的index.vue或者其他文件进行修改维护

### 三、目前存在的问题
#### 1. 部分模型显示不全
根据不同模型调整高度的逻辑被弃用(频繁调整高度,导致模型加载不出),具体参见index.vue下的updateModelHeight方法
希望大佬能够维护一下,为开源事业做出贡献,感激不尽


### 四、模型库
fghrsh-live2d: https://github.com/fghrsh/live2d_api

Raxcl-live2d: https://github.com/Raxcl/vue-live2d-models

### 五、参数说明([参考文档](https://github.com/evgo2017/vue-live2d))

### 1. 参数说明

Expand Down Expand Up @@ -103,16 +119,16 @@ $ npm run serve

这部分切换应该是与核心库有关,综合考虑不继续完善此功能。

## 三、核心库
## 六、参考资料
[1] evgo2017的live2d模型示例: https://github.com/evgo2017/vue-live2d

现版本是参考资料中的项目进行修改的,改动较大,核心为 `live2d.min.js` ,暂不知作者是谁。
[2] fghrsh的模型库api: https://github.com/fghrsh/live2d_api

也有查看 live2d 官网的 [Web SDK](https://www.live2d.com/download/cubism-sdk/download-web/) (4-r.1),综合考虑后目前采用此 js。
[3] iCharlesZ的vscode模型库: https://github.com/iCharlesZ/vscode-live2d-models

## 四、参考资料
[4] 一言接口 :'hitokoto.cn', 'jinrishici.com'(古诗词), 'api.fghrsh.net'

[1] https://github.com/fghrsh/live2d_demo
感谢以上提到的所有创作者!!!如有好的灵感或想法,欢迎fork

[2] https://github.com/stevenjoezhang/live2d-widget
( ˃ ˄ ˂̥̥ ) 都看到这了,点个 Star 吧 ~

[3] https://github.com/fghrsh/live2d_api
5 changes: 3 additions & 2 deletions example/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
<button @click="direction = 'right'">呆在右边</button>
<button @click="direction = 'left'">呆在左边</button>
</div>
<div>
<!-- 如需启用,需修改index.vue中with方法参数 -->
<!-- <div>
<span>size:</span>
<button @click="size = size - 100; width = width - 100; height = height - 100;">减小</button>
<button @click="size = size + 100; width = width + 100; height = height + 100;">增大</button>
</div>
</div> -->
<!-- 可尝试一个页面上多个模型: -->
<!-- <live2d
:model="[1, 53]"
Expand Down
1 change: 1 addition & 0 deletions live2d/lib/live2d.min.js

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions live2d/live2d.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<live2d
:style="style"
:model="[1, 53]"
:direction="direction"
:size="size"
:homePage="homePage"
></live2d>
</template>

<script>
/*
* 项目中引用包时,将 import 内容替换
* import live2d from 'vue-live2d'
*/
import live2d from "./vueLive2d";
export default {
name: "Live2d",
components: {
live2d,
},
data() {
return {
direction: "right",
// style: '',
style: "position: fixed; bottom: 0; right: 0; zIndex: 1",
// width: 500,
// height: 500,
size: 350,
homePage: "https://github.com/Raxcl",

};
},
created() {
// tips 未使用,可自行在组件绑定此参数,注意此参数只会初始化一次
// this.tips = this.tips;
},
};
</script>

<style>
body {
margin: 20px;
padding: 0;
/* position: fixed; */
/* right: 40; */
/* bottom: 40; */
}
</style>
163 changes: 163 additions & 0 deletions live2d/options/myModels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
export default {
myModel:[
[
'https://unpkg.com/live2d-widget-model-tororo@1.0.5/assets/tororo.model.json',
'https://unpkg.com/live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/chiaki_kitty/chiaki_kitty.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/chitose/chitose.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/date_16/date_16.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/epsilon/epsilon.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/hallo_16/hallo_16.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/haru01/haru01.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/haru02/haru02.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/haruto/haruto.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/hibiki/hibiki.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/index/index.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/izumi/izumi.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/jin/jin.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/kanzaki/kanzaki.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/kesshouban/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/Kobayaxi/Kobayaxi.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/koharu/koharu.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/kuroko/kuroko.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/len/len.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/len_impact/len_impact.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/len_space/len_space.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/len_swim/len_swim.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/mikoto/mikoto.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/miku/miku.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/murakumo/index.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/ni-j/ni-j.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/nico/nico.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/nietzsche/nietzsche.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/nipsilon/nipsilon.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/nito/nito.model.json',

],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/ryoufuku/ryoufuku.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/saten/saten.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/seifuku/seifuku.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/shifuku/shifuku.model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/shifuku2/shifuku2.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/shizuku-48/index.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/shizuku-pajama/index.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/stl/stl.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/touma/touma.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/tsumiki/tsumiki.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/uiharu/uiharu.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/unitychan/unitychan.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/wanko/wanko.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/wed_16/wed_16.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/z16/z16.model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/HK416-1/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/HK416-1/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/HK416-2/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/HK416-2/destroy/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP45-1/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP45-1/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP45-2/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP45-2/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP45-3/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP45-3/destroy/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4A1-1/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4A1-1/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4A1-2/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4A1-2/destroy/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4-SOPMOD-II-1/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4-SOPMOD-II-1/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4-SOPMOD-II-2/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/M4-SOPMOD-II-2/destroy/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/WA2000-1/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/WA2000-1/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/WA2000-2/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/WA2000-2/destroy/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/WA2000-3/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/WA2000-3/destroy/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/Kar98k/normal/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/G11/normal/model.json',
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/G11/destroy/model.json',
],
[
'https://cdn.jsdelivr.net/gh/Raxcl/vue-live2d-models/model-library/girls-frontline/UMP9/normal/model.json',
],

],
myMessage:[
"主人,我来啦~",
]
}
Loading