1681-engine / react / pixelFit
Function: pixelFit() ​
ts
function pixelFit(
w,
h,
boxW,
boxH,
maxScale?
): Size & object;Defined in: src/react/placement.ts:84
A sprite of w × h art pixels at the largest whole multiple that fits the box (never past maxScale), or a whole divisor when it is bigger than the box: object-fit: contain stretched a 26-px sprite by 2.77 and drew its pixels two and three screen pixels wide by turns.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
w | number | undefined |
h | number | undefined |
boxW | number | undefined |
boxH | number | undefined |
maxScale | number | Infinity |
Returns ​
Size & object