Capítulo 654 de 859

Chapter 654: Fog

Core Idea

This class can be used to define a linear fog that grows linearly denser with the distance.

Key Concepts

  • color : Color: The fog's color.
  • far : number: The maximum distance at which fog stops being calculated and applied. Objects that are more than far units away from the active camera wo…
  • isFog : boolean (readonly): This flag can be used for type testing.
  • name : string: The name of the fog.
  • near : number: The minimum distance to start applying fog. Objects that are less than near units from the active camera won't be affected by fog.

Code Examples

const scene = new THREE.Scene();
scene.fog = new THREE.Fog( 0xcccccc, 10, 15 );
  • What it demonstrates: Typical usage of Fog.

Reference Tables

Constructor

Signature
`new Fog( color : number

Properties

PropertyDescription
.color : ColorThe fog's color.
.far : numberThe maximum distance at which fog stops being calculated and applied. Objects that are more than far units away from the active camera won't be affected by fog.
.isFog : boolean (readonly)This flag can be used for type testing.
.name : stringThe name of the fog.
.near : numberThe minimum distance to start applying fog. Objects that are less than near units from the active camera won't be affected by fog.

Methods

MethodDescription
.clone() : FogReturns a new fog with copied values from this instance.
`.toJSON( meta : Objectstring ) : Object`

Key Takeaways

  1. Most relevant properties: color, far, isFog, name.
  2. Key methods: clone, toJSON.

Connects To