decal 0.6.0

Declarative DSL for describing scenes and rendering them to SVG or PNG
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::Drawable;

/// Capability for configuring opacity on a node.
pub trait Opacity: Drawable {
    /// Sets the opacity of the node (clamped to `[0.0, 1.0]`).
    ///
    /// # Arguments
    /// - `value`: The opacity value where `0.0` is fully transparent and `1.0`
    ///   is fully opaque.
    ///
    /// # Returns
    /// - [`Self`]
    fn opacity(mut self, value: f32) -> Self {
        self.visual_mut().opacity = value.clamp(0.0, 1.0);
        self
    }
}