Skip to main content

effets

Description

Cette bibliothèque comprend des fonctions permettant de mettre à jour les effets du monde tels que la boîte à ciel et le brouillard.

Les types

type NoFog = {type: 'none'}

type LinearFog = {
type: 'linear'
near: number
far: number
color: string
}

type ExponentialFog = {
type: 'exponential'
density: number
color: string
}

type Fog = NoFog | LinearFog | ExponentialFog
type Color = {type: 'color', color?: string}

type GradientStyle = 'linear' | 'radial'
type Gradient = {
type: 'gradient'
style?: GradientStyle
colors?: string[]
}
type Image<T = Resource> = {type: 'image', src?: T}
type NoSky = {type: 'none'}

type Sky<T = Resource> = Color | Gradient | Image<T> | NoSky

Fonctions

setFog

Définir le brouillard actif.

world.effects.setFog(fog: Fog) => void

Exemple

world.effects.setFog({type: 'linear', far: 1000, near: 0.1, color: 'ffffff'})

getFog

Obtenez le brouillard actif.

world.effects.getFog() => Fog | undefined

setSky

Définir le ciel actif.

world.effects.setSky(sky: Sky) => void

Exemple

world.effects.setSky({type: 'color', color: 'ffffff'})

getSky

Obtenez le ciel actif.

world.effects.getSky() => Sky | undefined