<canvas id="canvas" class="output" width="300" height="300"></canvas> | |
<script> | |
var ctx = document.getElementById("canvas").getContext("2d"); | |
var angle = .4; | |
var s = Math.sin(angle); | |
var c = Math.cos(angle); | |
ctx.beginPath(); | |
ctx.transform(c,s,-s,c,0,0); | |
ctx.moveTo(100,100); | |
ctx.lineTo(20,30); | |
ctx.transform(c,s,-s,c,0,0); | |
ctx.lineTo(40,-50); | |
ctx.stroke(); | |
</script> |