Skip to content

usePx 0.1.0 view source

function usePx(
  scope: Fusion.Scope,
  baseResolution: Fusion.UsedAs<Vector2>?,
  minimumScale: Fusion.UsedAs<number>?,
  dominantAxis: Fusion.UsedAs<number>?
): Px

Returns a state object with the current px unit based on the current viewport size.


Parameters

scope : Fusion.Scope

The scope to store cleanup tasks.

baseResolution : Fusion.UsedAs<Vector2>?

TThe base resolution to scale from, defaults to a Macbook Air's resolution.

minimumScale : Fusion.UsedAs<number>?

The smallest scale, defaults to 50%.

dominantAxis : Fusion.UsedAs<number>?

The axis to scale for, defaults to 1:1.


Returns -> Px

A px unit that scales with the viewport size.


Example Usage

-- TODO: write example