Canvas draw(reserve,callback)中回调只能调一次
发布于 5 年前 作者 wpeng 7737 次浏览 来自 问答

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 回复

没人回答啊?

回到顶部