HTMLキャンバスrotate()メソッド
例
長方形を20度回転します。
JavaScript:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.rotate(20 * Math.PI / 180);
ctx.fillRect(50, 20, 100, 50);
ブラウザのサポート
表の数字は、このメソッドを完全にサポートする最初のブラウザバージョンを示しています。
Method | |||||
---|---|---|---|---|---|
rotate() | Yes | 9.0 | Yes | Yes | Yes |
定義と使用法
rotate()メソッドは、現在の図面を回転させます。
注:回転は、回転が行われた後に作成された図面にのみ影響します。
JavaScript構文: | context .rotate(angle); |
---|
パラメータ値
Parameter | Description | Play it |
---|---|---|
angle | The rotation angle, in radians. To calculate from degrees to radians: degrees*Math.PI/180. Example: to rotate 5 degrees, specify the following: 5*Math.PI/180 |
❮HTMLキャンバスリファレンス