Skip to main content

soft_shadow

Function soft_shadow 

pub fn soft_shadow(
    scene: &mut Scene,
    transform: Affine,
    rect: Rect,
    color: AlphaColor<Srgb>,
    spread: f64,
    offset_y: f64,
    intensity: f32,
)
Expand description

Paint a soft drop shadow for rect.

  • color’s own alpha is ignored — pass the opaque hue; use intensity for strength.
  • spread extends the soft falloff this many logical px past every edge.
  • offset_y shifts the shadow downward (ambient light from above).
  • intensity in 0.0..=1.0 scales the whole shadow’s opacity.

9-sliced around the rect: corners get a fixed spread × spread circular sprite, edges stretch the 1-D profile along their own length. No-op for a degenerate rect, spread <= 0, or intensity <= 0.