貌似 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(); } |
模拟器效果:
真机效果: