Constructor
new Scratch(pageContext, opts)
Parameters:
Name |
Type |
Description |
pageContext |
Object
|
page路由指针 |
opts |
Object
|
组件所需参数
Properties
Name |
Type |
Description |
canvasWidth |
Number
|
画布宽带 |
canvasHeight |
Number
|
画布高度 |
imageResource |
String
|
遮罩层图片 |
r |
Number
|
笔触半径 |
awardTxt |
String
|
底部抽奖文字奖项 |
awardTxtColor |
String
|
底部抽奖文字颜色 |
awardTxtFontSize |
String
|
底部抽奖文字大小 |
maskColor |
String
|
没有图片遮罩层颜色 |
callback |
function
|
结束回调 |
|
- Author:
-
- Source:
- To Do:
-
- 1.drawImage 与 clearRect 清除展示移动端和模拟器不一致
- 2.小程序无globalCompositeOperation = 'destination-out'属性
- 3.小程序无getImageData获取像素点对比擦除范围
- 4.使用 downloadFile 这种方式来先加载图片再绘制
Example
new Scratch(this,{
canvasWidth: 197, //画布宽带
canvasHeight: 72, //画布高度
imageResource: './images/placeholder.png', //遮罩层图片
r: 4, //笔触半径
awardTxt: '中大奖', //底部抽奖文字奖项
awardTxtColor: "#1AAD16", //底部抽奖文字颜色
awardTxtFontSize: "24px", //底部抽奖文字大小
maskColor: "red", //没有图片遮罩层颜色
callback: () => {
//清除画布回调
}
})