Function fluid_glass

Source
pub fn fluid_glass(
    args: FluidGlassArgs,
    ripple_state: Option<Arc<RippleState>>,
    child: impl FnOnce(),
)
Expand description

Creates a fluid glass effect component, which serves as a dynamic and visually appealing background.

The fluid_glass component simulates the look of frosted or distorted glass with a fluid, animated texture. It can be used to create modern, layered user interfaces where the background content is blurred and stylized, enhancing depth and focus. The effect is highly customizable through FluidGlassArgs.

§Example

use tessera_ui_basic_components::{
    fluid_glass::{fluid_glass, FluidGlassArgs},
    text::text,
};

fluid_glass(FluidGlassArgs::default(), None, || {
    text("Content on glass".to_string());
});

§Arguments

  • args - A FluidGlassArgs struct that specifies the appearance and behavior of the glass effect. This includes properties like tint color, shape, blur radius, and noise level. The builder pattern is recommended for constructing the arguments.

  • ripple_state - An optional Arc<RippleState> to enable and manage a ripple effect on user interaction, such as a click. When None, no ripple effect is applied.

  • child - A closure that defines the child components to be rendered on top of the glass surface. These children will be contained within the bounds of the fluid_glass component.