pub struct BoxShadow {
pub color: Color,
pub offset: (f32, f32),
pub blur: f32,
pub spread: f32,
pub blur_style: BlurStyle,
}Expand description
A soft drop shadow.
Fields§
§color: ColorColour; its alpha sets the intensity.
offset: (f32, f32)Offset (dx, dy), in logical pixels.
blur: f32Blur radius.
spread: f32How far the shadow grows beyond the box, before blurring.
blur_style: BlurStyleWhich side of the shadow’s edge the blur keeps (milestone 645): both, by default.
Implementations§
Source§impl BoxShadow
impl BoxShadow
Sourcepub const fn new(dx: f32, dy: f32, blur: f32, color: Color) -> BoxShadow
pub const fn new(dx: f32, dy: f32, blur: f32, color: Color) -> BoxShadow
A shadow offset by (dx, dy) with blur, and no spread.
Sourcepub const fn blur_style(self, style: BlurStyle) -> BoxShadow
pub const fn blur_style(self, style: BlurStyle) -> BoxShadow
Sets which side of the edge the blur keeps: a solid shadow with a soft edge, a glow outside the box only, a shading inside it.
Sourcepub fn for_elevation(elevation: f32, color: Color) -> [BoxShadow; 3]
pub fn for_elevation(elevation: f32, color: Color) -> [BoxShadow; 3]
The three shadows a surface elevation high casts, in color: a sharp one close
under it, a softer one further down, and a wide faint one all round. The reference’s
own table, and its three strengths — a fifth, a seventh and an eighth of color’s
opacity — so color is the shadow’s colour at full strength, black by default
(milestone 606).
Between two heights of the table the shadows are interpolated, so a height that animates moves smoothly; past twenty-four, it is twenty-four.