pub struct Glass {Show 22 fields
pub variant: GlassVariant,
pub shape: LiquidShape,
pub tint: Option<Color>,
pub blur_radius: Option<f32>,
pub saturation: Option<f32>,
pub refraction_depth: f32,
pub refraction_curve: f32,
pub dispersion: f32,
pub transmission_refraction: f32,
pub meniscus_absorption: f32,
pub fold_depth: f32,
pub optical_zoom: f32,
pub rim_reflection: f32,
pub ink_recolor: Option<(Color, f32)>,
pub highlight: f32,
pub lift: Option<f32>,
pub contrast: Option<f32>,
pub shadow: bool,
pub shadow_style: Option<GlassShadow>,
pub clip: bool,
pub foreground: Option<Color>,
pub adaptive_frost: f32,
}Expand description
Builder describing a glass material. Resolved against the theme at the composition site, then evaluated per frame for density and dynamics.
Fields§
§variant: GlassVariant§shape: LiquidShape§tint: Option<Color>Tint over the refracted backdrop; defaults to the theme’s glass tint.
blur_radius: Option<f32>Backdrop blur radius in dp (defaults per variant).
saturation: Option<f32>Saturation boost (defaults per variant).
refraction_depth: f32wcKSRD refraction depth as a fraction of the shape inradius.
refraction_curve: f32Normalized wcKSRD ray-return exponent.
dispersion: f32Normalized wcKSRD spectral ray separation.
transmission_refraction: f32Fraction of the wcKSRD displacement applied to the transmitted backdrop. The mirrored meniscus follows its own optical path.
meniscus_absorption: f32Energy removed from the transmitted ray at the meniscus. Reflection and spectral return follow independent paths.
fold_depth: f32Depth of the rim fold band in dp: the raised lens rim replays its interior mirrored toward the edge (a pure displacement). Zero disables the fold.
optical_zoom: f32Uniform face magnification of a riding lens (1.0 = no zoom): the backdrop projects enlarged across the whole face while the rim band keeps the wcKSRD edge mapping.
rim_reflection: f32Meniscus rim reflectivity multiplier (1.0 = the reference toggle’s visible rim line; near 0 = the segmented lens’s invisible body).
ink_recolor: Option<(Color, f32)>Optical ink recolor: the lens recolors dark transmitted ink toward this color at the given strength (the reference tab bubble’s color-mask act). None = off.
highlight: f32Specular rim intensity.
lift: Option<f32>Screen-lift override (brightening toward white; negative darkens). Defaults per variant.
contrast: Option<f32>Tone-compression override around the shader’s mid pivot (<1 pulls every backdrop toward mid-luminance — the reference dark menu reads bright magenta over deep purple AND dim gray over white through one law). Defaults per variant.
shadow: boolDrop shadow below the glass.
shadow_style: Option<GlassShadow>Per-surface shadow override.
clip: boolClip the layer to shape. Morphing glass disables this — coverage
comes entirely from the shader’s SDF.
foreground: Option<Color>Foreground color whose contrast the frost must protect. None uses
the theme label color.
adaptive_frost: f32Strength of backdrop+foreground frost adaptation.
Implementations§
Source§impl Glass
impl Glass
pub fn regular() -> Self
pub fn clear() -> Self
Sourcepub fn lens() -> Self
pub fn lens() -> Self
The interactive lens bubble (reference: the iOS toggle/tab-bar drag lens): fully transparent, magnifying dome across the whole element, strong rainbow rim.
pub fn shape(self, shape: LiquidShape) -> Self
pub fn tint(self, tint: Color) -> Self
pub fn blur_radius(self, radius_dp: f32) -> Self
pub fn saturation(self, saturation: f32) -> Self
pub fn refraction_depth(self, fraction: f32) -> Self
pub fn refraction_curve(self, curve: f32) -> Self
pub fn dispersion(self, strength: f32) -> Self
pub fn transmission_refraction(self, strength: f32) -> Self
pub fn meniscus_absorption(self, strength: f32) -> Self
Sourcepub fn fold_depth(self, depth_dp: f32) -> Self
pub fn fold_depth(self, depth_dp: f32) -> Self
Sets the rim fold band depth in dp (zero disables the fold).
Sourcepub fn optical_zoom(self, zoom: f32) -> Self
pub fn optical_zoom(self, zoom: f32) -> Self
Sets the uniform face magnification of a riding lens (1.0 = none).
Sourcepub fn rim_reflection(self, reflectivity: f32) -> Self
pub fn rim_reflection(self, reflectivity: f32) -> Self
Sets the meniscus rim reflectivity (1.0 = full reference line).
Sourcepub fn ink_recolor(self, color: Color, strength: f32) -> Self
pub fn ink_recolor(self, color: Color, strength: f32) -> Self
The lens recolors dark transmitted ink toward color at strength
(0..1) — the reference bubble’s color-mask act as a material optic.
pub fn highlight(self, highlight: f32) -> Self
Sourcepub fn lift(self, lift: f32) -> Self
pub fn lift(self, lift: f32) -> Self
Overrides the screen-lift (how hard the glass brightens what it shows; the bar lens uses a near-zero lift to stay transmissive).
Sourcepub fn contrast(self, contrast: f32) -> Self
pub fn contrast(self, contrast: f32) -> Self
Overrides the tone compression around the shader’s mid pivot (values below one pull every backdrop toward mid-luminance).