Skip to content

Commit

Permalink
更新图片透明
Browse files Browse the repository at this point in the history
  • Loading branch information
AfanSama committed Aug 30, 2018
1 parent 3b91b20 commit 91f55b6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## esay-canvas

新增更新[图片透明度](https://github.com/AfanSama/esay-canvas#image图片)

新增功能[矩形、圆角矩形绘制阴影效果](https://github.com/AfanSama/esay-canvas#rect-矩形线条)

新增 [esay-canvas](https://github.com/AfanSama/esay-canvas)。之后同步更新。
Expand Down Expand Up @@ -113,7 +115,8 @@ git clone https://github.com/AfanSama/esay-canvas
top: 136,
left: 42.5,
width: 290,
height: 186
height: 186,
opacity:70
},
{
type: 'image',
Expand Down Expand Up @@ -246,6 +249,7 @@ left | 左上角距离画板左侧的距离 | |
width | 要画多宽 | 0 |
height | 要画多高 | 0 |
borderRadius|是否圆形|0|true
opacity|图片透明度|100|1-100(对应百分比)

### text(文本)
属性 | 含义 | 默认值 | 可选值
Expand Down
4 changes: 3 additions & 1 deletion components/esay-canva/esay-canva.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ Component({
left = 0,
width = 0,
height = 0,
borderRadius = 0
borderRadius = 0,
opacity = 100,
} = params
this.ctx.globalAlpha = opacity / 100;
if (borderRadius) {
this.ctx.fill();
this.ctx.beginPath()
Expand Down
3 changes: 2 additions & 1 deletion pages/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Page({
top: 136,
left: 42.5,
width: 290,
height: 186
height: 186,
opacity:70
},
{
type: 'image',
Expand Down
2 changes: 1 addition & 1 deletion project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.2.0",
"appid": "",
"appid": "wx02f9db482f87f63c",
"projectname": "esay-canvas",
"isGameTourist": false,
"condition": {
Expand Down

0 comments on commit 91f55b6

Please sign in to comment.