pixelRatioFor関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The device pixel ratio to draw a width x height view at: the screen's own, held to 2, to 4096 pixels a side and to 6 million in all. At least 0.25, and 1 for a nonsense value.
インポート
import { pixelRatioFor } from "@johnmorrisdotca/uchusen-rockets";
定義
function pixelRatioFor(width: number, height: number, deviceRatio: number): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
width | number | The view's width in CSS pixels. |
height | number | Its height in CSS pixels. |
deviceRatio | number | The screen's own pixel ratio. |
戻り値
number
The ratio to draw at.
例
import { pixelRatioFor } from "@johnmorrisdotca/uchusen-rockets";
console.log(pixelRatioFor(620, 827, 3), pixelRatioFor(3000, 3000, 2));2 0.816496580927726出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。