Reference pixelDensity()

pixelDensity()

Sets the pixel density or returns the current density.

Computer displays are grids of little lights called pixels. A display's pixel density describes how many pixels it packs into an area. Displays with smaller pixels have a higher pixel density and create sharper images.

pixelDensity() sets the pixel scaling for high pixel density displays. By default, the pixel density is set to match the display's density. Calling pixelDensity(1) turn this off.

Calling pixelDensity() without an argument returns the current pixel density.

Examples

Syntax

pixelDensity([val])
pixelDensity()

Parameters

val
Number:

desired pixel density.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/environment.js and open a pull request!

Related References