Canvas draw(reserve,callback)中回调只能调一次

发布于 6 年前作者 wpeng7936 次浏览最后编辑 6 年前来自 ask

var ctx;

onLoad: function (options) {

   ctx = wx.createCanvasContext(‘myCanvas’);

   this.Draw();

},

Draw: function () {

   debugger

   let colors = [“#6A0000”, “#900000”, “#902B2B”, “#A63232”, “#A62626”, “#FD5039”, “#C12F2A”, “#FF6540”, “#f93801”];

   let colornum = colors[~~(Math.random() * colors.length)];

   ctx.setFillStyle(colornum)

   ctx.fillRect(10, 10, 150, 100)

   ctx.draw(false, this.Draw);

},

这时Draw()方法调用2次后停止,请问这是啥问题?应该无限调用啊!

1 回复
xuwei
xuwei1 楼4 年前

没人回答啊?