onTapCanvas: function (event) {
console.log("onTapCanvas ", event);
let that = this
let canvasX = event.detail.x - event.currentTarget.offsetLeft
let canvasY = event.detail.y - event.currentTarget.offsetTop
let centerX = canvasX - size * 0.5
let centerY = canvasY - size * 0.5
let ctx = that.canvasContext
let path = “…/…/images/SH04-CO00.jpg”
ctx.drawImage(path, centerX, centerY, 64, 64)
ctx.draw(true, function () {
})
},
这样一段代码,手动在画布上进行单词点击绘制图片,进行这样的操作多次之后,每次绘制的帧率越来越慢,从刚开50fps一直降到20多,看到图片绘制到画布的反馈越来越慢。
注:ctx.draw中true参数是为了保留之前绘制的内容。
请问是什么原因造成这个效率下降的?