diff --git a/test/example/transform.js b/test/example/transform.js new file mode 100644 index 0000000..b46ef3b --- /dev/null +++ b/test/example/transform.js @@ -0,0 +1,21 @@ +window.C2S_EXAMPLES['transform'] = function(ctx) { + // case 1 + ctx.fillStyle = "rgba(255, 0, 0, 0.5)"; + ctx.setTransform(1,1,0,1,0,0); + ctx.fillRect(0,0,100,100); + + // case 2 + ctx.resetTransform(); + ctx.fillStyle = "red"; + ctx.fillRect(0, 0, 50, 50); + + // case 3 + ctx.resetTransform(); + ctx.fillStyle = "rgba(0, 0, 255, 0.5)"; + ctx.moveTo(0, 0); + ctx.lineTo(100, 0) + ctx.transform(2, 0, 0, 2, 0, 0) + ctx.lineTo(100, 100) + ctx.closePath() + ctx.fill() +} \ No newline at end of file