求助~ 求助~ 求助~
const ctx = wx.createCanvasContext('canvasID');
function drawPic(){
ctx.save();
var picList = that.data.picList;
for (var i = 0; i < picList.length;i++){
if (picList[i].isStop != 1) {
ctx.drawImage(
picList[i].picName,
picList[i].posleft,
picList[i].postop,
picList[i].width,
picList[i].height
)
}
}
ctx.restore();
ctx.draw();
}
/-----------分割线----------/
goAnimate();
var lastTime = 0;
function goAnimate() {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 30 - (currTime - lastTime));
fishMaoTimeOut = setTimeout(function() {
goAnimate();
}, timeToCall);
drawPic();
}
你好,建议可以换成 canvas 2d 接口,结合 requestAnimationFrame使用。
各位游侠给个思路啊,换方式可以的啊😭