Reference · Rockets, variants, parts and the fit check
pixelRatioForfunction
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 it
import { pixelRatioFor } from "@johnmorrisdotca/uchusen-rockets";
Definition
function pixelRatioFor(width: number, height: number, deviceRatio: number): number
Parameters
| Name | Type | Description |
|---|---|---|
width | number | The view's width in CSS pixels. |
height | number | Its height in CSS pixels. |
deviceRatio | number | The screen's own pixel ratio. |
Returns
number
The ratio to draw at.
Examples
import { pixelRatioFor } from "@johnmorrisdotca/uchusen-rockets";
console.log(pixelRatioFor(620, 827, 3), pixelRatioFor(3000, 3000, 2));2 0.816496580927726What it prints (run when this page was built)