pub struct PlaceholderStyle {
pub background_color: [f32; 4],
pub skeleton_line_color: [f32; 4],
pub animate: bool,
pub shimmer_speed: f32,
pub shimmer_amplitude: f32,
}Expand description
Visual configuration for loading-placeholder tiles.
A single instance is stored on MapState and
applies to all sources. All colours use linear RGBA [f32; 4].
Fields§
§background_color: [f32; 4]Background fill colour for the placeholder quad.
Default: light grey [0.90, 0.90, 0.90, 1.0].
skeleton_line_color: [f32; 4]Colour of optional skeleton-chrome lines drawn inside the placeholder to hint at future geometry (roads, blocks, etc.).
Set the alpha to 0 to disable skeleton lines entirely.
Default: slightly darker grey [0.82, 0.82, 0.82, 1.0].
animate: boolWhether the pulsing shimmer animation is enabled.
When true, renderers modulate the placeholder opacity using
LoadingPlaceholder::animation_phase.
Default: true.
shimmer_speed: f32Speed of the shimmer animation in cycles per second.
Higher values produce a faster pulse. Ignored when animate
is false.
Default: 1.2 Hz.
shimmer_amplitude: f32Peak-to-trough opacity amplitude of the shimmer effect.
A value of 0.15 means the opacity oscillates between
1.0 - 0.15 = 0.85 and 1.0.
Default: 0.15.
Implementations§
Source§impl PlaceholderStyle
impl PlaceholderStyle
Sourcepub fn with_background_color(self, color: [f32; 4]) -> Self
pub fn with_background_color(self, color: [f32; 4]) -> Self
Builder: set the background fill colour.
Sourcepub fn with_skeleton_line_color(self, color: [f32; 4]) -> Self
pub fn with_skeleton_line_color(self, color: [f32; 4]) -> Self
Builder: set the skeleton line colour.
Sourcepub fn with_animate(self, animate: bool) -> Self
pub fn with_animate(self, animate: bool) -> Self
Builder: enable or disable shimmer animation.
Sourcepub fn with_shimmer_speed(self, speed: f32) -> Self
pub fn with_shimmer_speed(self, speed: f32) -> Self
Builder: set the shimmer animation speed in Hz.
Sourcepub fn with_shimmer_amplitude(self, amplitude: f32) -> Self
pub fn with_shimmer_amplitude(self, amplitude: f32) -> Self
Builder: set the shimmer amplitude.
Sourcepub fn shimmer_opacity(&self, phase: f32) -> f32
pub fn shimmer_opacity(&self, phase: f32) -> f32
Compute the shimmer opacity multiplier for a given animation phase.
Returns a value in [1.0 - amplitude, 1.0] when animate is
true, or 1.0 when disabled.
Trait Implementations§
Source§impl Clone for PlaceholderStyle
impl Clone for PlaceholderStyle
Source§fn clone(&self) -> PlaceholderStyle
fn clone(&self) -> PlaceholderStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more