多次调用 setTransfrom 的问题?
发布于 5 年前 作者 ping29 16545 次浏览 来自 问答

貌似 setTransfrom 真机的表现和模拟器中的表现不一致。

onLoad() {
        this.context = wx.createCanvasContext("surface");
         
        for ( var i = 0; i < 4; ++i ) {
            this.context.save();
            this.context.setTransform(1, 0, 0, 1, 100 * i, 100 * i);
            this.context.fillStyle = "rgba(0, 200, 0, 0.5)";
            this.context.fillRect(0, 0, 100, 100);
            this.context.fill();
            this.context.restore();
        }
         
        this.context.draw();
}

模拟器效果:

真机效果:

回到顶部