Skip to content

Options ​

ts
import { startGameGlass, GLASS_DEFAULTS } from 'mri-fivem-liquid-glass'

const glass = startGameGlass({ blur: 18, saturation: 1.2 })
// glass.refresh() re-reads radius, clipping and attributes after inline style changes
// glass.stop() removes the canvas and stops everything

This table is generated from the library source, so it is always current.

OptionTypeDefaultMeaning
selectorstring"[data-glass]"CSS selector of the elements that get glass.
scalenumber0.25Size of the blur buffer relative to the screen. Lower is cheaper and softer.
blurnumber14Gaussian sigma of the blur, in screen pixels.
saturationnumber1.15Saturation of the backdrop (1 keeps the game colors).
darkennumber1Brightness multiplier of the backdrop (below 1 darkens it).
temporalnumber0.45Weight of each new frame at 60 fps, scaled by the real frame time. 1 disables smoothing.
zIndexnumber0z-index of the glass canvas. Your UI root must sit above it.
toneIntervalnumber200Milliseconds between data-glass-backdrop updates.
light[number, number][-0.6,-0.8]Direction of the rim highlight in screen space (x right, y down). Default comes from the top left.
fallbackImagestring | TexImageSource | nullnullImage used instead of the game outside FiveM (browser dev, screenshots). A canvas or video is read live every frame, so a 3D scene or a gameplay clip works as a moving backdrop. Without it the library stays off outside the game.

The same data is available as JSON at /api/v1/options.json.

Changing options at runtime ​

Options are read when the glass starts. To change blur or saturation live, stop and start again; it is cheap:

ts
let glass = startGameGlass({ blur: 14 })

function setBlur(value: number) {
  glass.stop()
  glass = startGameGlass({ blur: value })
}

Per element looks (bezel, refraction, dispersion, lenses) are attributes, so they change live without a restart. See Markup.

MIT licensed. Not affiliated with Apple, Cfx.re or Rockstar Games.