rotate() メソッド
実行結果
コード
/* 元の矩形を赤色で描く */ ctx.strokeStyle = "red"; ctx.strokeRect(30, 10, 60, 20); /* 45°回転した矩形を青色で描く */ ctx.rotate( 45 * Math.PI / 180 ); ctx.strokeStyle = "blue"; ctx.strokeRect(30, 10, 60, 20);
/* 元の矩形を赤色で描く */ ctx.strokeStyle = "red"; ctx.strokeRect(30, 10, 60, 20); /* 45°回転した矩形を青色で描く */ ctx.rotate( 45 * Math.PI / 180 ); ctx.strokeStyle = "blue"; ctx.strokeRect(30, 10, 60, 20);