tiltTurn関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The turn (degrees round, degrees up or down) for a reading, measured from rest (how the device was held when tilting began). angle is the screen's orientation (0, 90, 180 or 270), so leaning a phone held sideways still turns the view the way it looks. Null for an empty reading.
インポート
import { tiltTurn } from "@johnmorrisdotca/uchusen-rockets";
定義
function tiltTurn(reading: Reading, rest: Reading, angle?: number): { azimuth: number; polar: number; } | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
reading | Reading | The current reading. |
rest | Reading | The reading when tilting began. |
angle (省略可) | number | The screen's orientation: 0, 90, 180 or 270. Defaults to 0. |
戻り値
{ azimuth: number; polar: number; } | null
The turn in degrees round (azimuth) and up or down (polar), or null for an empty reading.
例
import { tiltTurn } from "@johnmorrisdotca/uchusen-rockets";
console.log(tiltTurn({ beta: 30, gamma: 10 }, { beta: 20, gamma: 0 }), tiltTurn({ beta: null, gamma: null }, { beta: 0, gamma: 0 }));{ azimuth: 6, polar: -3 } null出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。