Atmosphere
Atmosphere configures the atmospheric effects around the globe, including fog, sky color, horizon blend, and stars. It creates a realistic visualization of the Earth’s atmosphere when using globe projection.Import
Basic Usage
Props
style
Customizable style attributes for the atmosphere.
Style Properties
Thestyle prop accepts an AtmosphereLayerStyleProps object with the following properties:
range
The start and end distance range in which fog fades from fully transparent to fully opaque. The distance to the point at the center of the map is defined as zero, so negative values are closer to the camera, and positive values are farther away.Range: -20 to 20
rangeTransition
The transition affecting any changes to the range property.
color
The color of the atmosphere region immediately below the horizon and within the
range, and above the horizon and within horizonBlend. Using opacity is recommended only for smoothly transitioning fog on/off, as anything less than 100% opacity results in more tiles being loaded and drawn.colorTransition
The transition affecting any changes to the color property.
highColor
The color of the atmosphere region above the horizon.
highColor extends further above the horizon than the color property, and its spread can be controlled with horizonBlend. The opacity can be set to 0 to remove the high atmosphere color contribution.highColorTransition
The transition affecting any changes to the highColor property.
spaceColor
The color of the region above the horizon and after the end of the
horizonBlend contribution. This represents outer space. The opacity can be set to 0 to have a transparent background.spaceColorTransition
The transition affecting any changes to the spaceColor property.
horizonBlend
Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky.Range: 0 to 1
horizonBlendTransition
style.horizonBlendTransition
{ duration: number, delay: number }
default:"{ duration: 300, delay: 0 }"
The transition affecting any changes to the horizonBlend property.
starIntensity
A value controlling the star intensity where
0 will show no stars and 1 will show stars at their maximum intensity.Range: 0 to 1starIntensityTransition
style.starIntensityTransition
{ duration: number, delay: number }
default:"{ duration: 300, delay: 0 }"
The transition affecting any changes to the starIntensity property.
verticalRange
An array of two number values, specifying the vertical range, measured in meters, over which the fog should gradually fade out. When both parameters are set to zero, the fog will be rendered without any vertical constraints.Minimum: 0
verticalRangeTransition
style.verticalRangeTransition
{ duration: number, delay: number }
default:"{ duration: 300, delay: 0 }"
The transition affecting any changes to the verticalRange property.
Examples
- Basic Atmosphere
- Night Sky
- Sunrise
- With Fog
- Time-Based Atmosphere
Best Practices
-
Use with Globe Projection: Atmosphere effects are most visible and impactful when using
projection="globe"on the MapView. -
Performance Considerations: Using opacity values less than 100% on the
colorproperty results in more tiles being loaded. Use opacity sparingly. - Smooth Transitions: Use transition properties to create smooth animations when changing atmospheric conditions.
- Coordinate with Style: Match your atmosphere colors with your map style for a cohesive visual experience.
Related Components
- MapView - The map container (use with
projection="globe") - Light - Configure lighting for 3D features
- StyleImport - Configure the Mapbox Standard style
- SkyLayer - Alternative sky configuration