diff options
Diffstat (limited to 'files/ja/web/api/gamepad/axes')
-rw-r--r-- | files/ja/web/api/gamepad/axes/index.html | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/files/ja/web/api/gamepad/axes/index.html b/files/ja/web/api/gamepad/axes/index.html new file mode 100644 index 0000000000..12c5e43863 --- /dev/null +++ b/files/ja/web/api/gamepad/axes/index.html @@ -0,0 +1,79 @@ +--- +title: Gamepad.axes +slug: Web/API/Gamepad/axes +tags: + - API + - Gamepad API + - Games + - NeedsBetterSpecLink + - NeedsMarkupWork + - Property + - Reference + - Référence(2) +translation_of: Web/API/Gamepad/axes +--- +<p>{{APIRef("Gamepad API")}}</p> + +<p>{{domxref("Gamepad") }} インターフェースの <code><strong>Gamepad.axes</strong></code> プロパティは<span class="tlid-translation translation"><span title="">デバイス上に存在する軸を持つコントロールを表す配列を返します。</span></span> (例 : アナログスティック)。</p> + +<p><span class="tlid-translation translation"><span title="">配列の各エントリは -1.0 〜 1.0 の範囲の浮動小数点値で、最小値 (-1.0) から最大値 (1.0) までの軸の位置を表します。</span></span></p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox notranslate"><span class="idlInterface" id="idl-def-Gamepad"><span class="idlAttribute">readonly attribute <span class="idlAttrType">double[]</span> <span class="idlAttrName">axes</span>;</span></span></pre> + +<h2 id="例">例</h2> + +<pre class="brush: js notranslate">function gameLoop() { + if(navigator.webkitGetGamepads) { + var gp = navigator.webkitGetGamepads()[0]; + } else { + var gp = navigator.getGamepads()[0]; + } + + if(gp.axes[0] != 0) { + b -= gp.axes[0]; + } else if(gp.axes[1] != 0) { + a += gp.axes[1]; + } else if(gp.axes[2] != 0) { + b += gp.axes[2]; + } else if(gp.axes[3] != 0) { + a -= gp.axes[3]; + } + + ball.style.left = a*2 + "px"; + ball.style.top = b*2 + "px"; + + var start = rAF(gameLoop); +};</pre> + +<h2 id="値">値</h2> + +<p>{{domxref("double") }} の値の配列。</p> + +<h2 id="仕様">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName("Gamepad", "#widl-Gamepad-axes", "Gamepad.axes")}}</td> + <td>{{Spec2("Gamepad")}}</td> + <td>初版</td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザ互換性">ブラウザ互換性</h2> + + + +<p>{{Compat("api.Gamepad.axes")}}</p> + +<h2 id="参照">参照</h2> + +<p><a href="/docs/Web/Guide/API/Gamepad">Gamepad API を利用する</a></p> |