Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
add opacity(beta)(#12) and fix README bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazeyu committed Nov 3, 2017
1 parent 9201848 commit 25bad6c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ var config = Object.assign( {
model: "z16",
width: 150,
height: 300,
opacity: 0.9,
mobileShow: "true",
mobileWidth: 75,
mobileHeight: 150,
mobileOpacity: 0.8,
position: "right",
horizontalOffset: 0,
verticalOffset: -20,
Expand All @@ -50,6 +52,7 @@ hexo.extend.helper.register('live2d', function() {
z-index: 999;
pointer-events: none;
bottom: ${config.verticalOffset}px;
opacity: ${config.opacity};
}
</style>
<script src="/live2d/device.min.js"></script>
Expand All @@ -59,6 +62,7 @@ hexo.extend.helper.register('live2d', function() {
${config.mobileShow ? `
document.getElementById("${config.id}").width = ${config.mobileWidth};
document.getElementById("${config.id}").height = ${config.mobileHeight};
document.getElementById("${config.id}").style.opacity = ${config.mobileOpacity};
document.write('<script type="text/javascript" src="/live2d/script.js"><\\/script>');
document.write('<script>loadlive2d(${JSON.stringify(config.id)}, ${JSON.stringify(url.resolve("/live2d/assets/", config.model + ".model.json"))}, 0.5)<\\/script>');
` : ``}
Expand Down
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Demo: [https://huaji8.top/post/live2d-plugin-2.0/](https://huaji8.top/post/live2
Install module:

```
npm install -save hexo-helper-live2d
npm install --save hexo-helper-live2d
```

> Tips: If you run into a npm problem, try to use `npm cache verify` or `npm cache clean` to fix it.
Expand Down Expand Up @@ -73,9 +73,11 @@ live2d:
model: z16 # The model that you are willing to show. default: z16
width: 150 # The width of your model. default: 150
height: 300 # The height of your model. default: 300
opacity: 0.9 # The opacity of your model. default: 0.9
mobileShow: true # Whether to show on mobile devices. default: true
mobileWidth: 75 # The width of your model on mobile devices. default: 150
mobileHeight: 150 # The height of your model on mobile devices. default: 75
mobileOpacity: 0.8,# The opacity of your model on mobile devices. default: 0.8
position: right # Which side the model is shown at. default: right
horizontalOffset: 0 # The horizontal offset. default: 0
verticalOffset: -20 # The offset of the bottom. default: -20
Expand Down Expand Up @@ -108,9 +110,11 @@ live2d:

- `width`: The width of your model. default: 150
- `height`: The height of your model. default: 300
- `opacity`: The opacity of your model. default: 0.9
- `mobileShow`: Whether to show on mobile devices. default: true
- `mobileWidth`: The width of your model on mobile devices. default: 150
- `mobileHeight`: The height of your model on mobile devices. default: 75
- `mobileOpacity`: The opacity of your model on mobile devices. default: 0.8
- `horizontalOffset`: The horizontal offset. default: 0
- `verticalOffset`: The offset of the bottom. default: -20
- `position`: `left` or `right` side the model is shown at. default: right
Expand Down
6 changes: 5 additions & 1 deletion readme.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
安装模块:

```
npm install -save hexo-helper-live2d
npm install --save hexo-helper-live2d
```

> Tips: 遇到npm的相关错误,试试 `npm cache verify``npm cache clean`~
Expand Down Expand Up @@ -75,9 +75,11 @@ live2d:
model: z16 # 模型名称 默认值: z16
width: 150 # 宽度 默认值: 150
height: 300 # 高度 默认值: 300
opacity: 0..9 # 透明度 默认值: 0.9
mobileShow: true # 是否在移动设备上显示 默认值: true
mobileWidth: 75 # 移动设备上的宽度 默认值: 75
mobileHeight: 150 # 移动设备上的高度 默认值: 150
mobileOpacity: 0.8 # 移动设备上的透明度 默认值: 0.8
position: right # 模型左右侧放置位置 默认值: right
horizontalOffset: 0 # 元素的水平偏移 默认值: 0
verticalOffset: -20 # 元素的底部偏移 默认值: -20
Expand Down Expand Up @@ -109,9 +111,11 @@ live2d:

- `width`: 宽度 默认值: 150
- `height`: 高度 默认值: 300
- `opacity`: 透明度 默认值: 0.9
- `mobileShow`: 是否在移动设备上显示 默认值: true
- `mobileWidth`: 移动设备上的宽度 默认值: 75
- `mobileHeight`: 移动设备上的高度 默认值: 150
- `mobileOpacity`: 移动设备上的透明度 默认值: 0.8
- `position`: 模型左右侧放置位置 `left` 或 `right` 默认值: false
- `horizontalOffset`: `<canvas>` 元素的水平偏移 默认值: 0
- `verticalOffset`: `<canvas>` 元素的底部偏移 默认值: -20
Expand Down

0 comments on commit 25bad6c

Please sign in to comment.