Skip to content

Opções ​

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

const glass = startGameGlass({ blur: 18, saturation: 1.2 })
// glass.refresh() relê raio, corte e atributos depois de mudar style inline
// glass.stop() tira o canvas e para tudo

A tabela vem do código da biblioteca, então está sempre atual (descrições em inglês).

OpçãoTipoPadrãoSignificado
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.

Mudar opção com a tela aberta ​

As opções são lidas ao iniciar. Pra mudar blur ou saturation ao vivo, pare e inicie de novo, que é barato:

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

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

O visual por elemento (bisel, refração, dispersão, lentes) é atributo e muda ao vivo sem reiniciar. Veja Marcação.

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