pub struct Elevation { /* private fields */ }Expand description
Height above the surface, expanded into contact, key and ambient shadows.
A small dark contact shadow anchors the object, a medium key shadow follows the
light direction and a wide faint ambient shadow suggests occlusion. Sigmas and
offsets grow linearly with height, while opacity falls off smoothly.
use motion_core::{Color, Elevation, NodeModifiers, Rect};
let card = Rect::new(0.0, 0.0, 80.0, 50.0).fill(Color::WHITE);
let raised = card.elevated(Elevation::shadow(12.0)?);Implementations§
Source§impl Elevation
impl Elevation
Sourcepub const MAX_HEIGHT: f64 = 1024.0
pub const MAX_HEIGHT: f64 = 1024.0
Largest accepted height in local units.
Sourcepub fn shadow(height: f64) -> Result<Self, ValidationError>
pub fn shadow(height: f64) -> Result<Self, ValidationError>
Creates a downward-falling black shadow stack for a finite height in 0..=1024.
Sourcepub fn direction(self, direction: Vector2) -> Result<Self, ValidationError>
pub fn direction(self, direction: Vector2) -> Result<Self, ValidationError>
Sets the direction the shadow falls; the vector is normalized.
Sourcepub fn color(self, color: Color) -> Self
pub fn color(self, color: Color) -> Self
Sets the encoded-sRGB shadow color; its alpha scales every layer.
Sourcepub fn layers(self) -> Vec<ShadowLayer>
pub fn layers(self) -> Vec<ShadowLayer>
Contact, key and ambient layers; empty at zero height.
Trait Implementations§
impl Copy for Elevation
impl StructuralPartialEq for Elevation
Auto Trait Implementations§
impl Forget for Elevation
impl Freeze for Elevation
impl RefUnwindSafe for Elevation
impl Send for Elevation
impl Sync for Elevation
impl Unpin for Elevation
impl UnsafeUnpin for Elevation
impl UnwindSafe for Elevation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more