pub struct Effect {
pub opacity: f32,
pub offset: Point,
pub scale: f32,
}Expand description
A visual change applied to painted content without touching layout: what a compositor would do to a layer, here done to the display list.
Fields§
§opacity: f32Multiplies alpha, 0.0 to 1.0. Each primitive fades on its own, so
shapes that overlap show through each other while partly faded.
offset: PointMovement in logical pixels.
scale: f32Size multiplier around the pivot.
Implementations§
Source§impl Effect
impl Effect
Fully transparent.
Sourcepub const fn with_opacity(self, opacity: f32) -> Self
pub const fn with_opacity(self, opacity: f32) -> Self
The same effect with this opacity.
Sourcepub const fn with_scale(self, scale: f32) -> Self
pub const fn with_scale(self, scale: f32) -> Self
The same effect with this scale.
Sourcepub fn lerp(self, to: Self, t: f32) -> Self
pub fn lerp(self, to: Self, t: f32) -> Self
The effect t of the way from self to to: 0.0 is self, 1.0 is to.
t is not clamped, so springs and overshooting curves carry through.
Sourcepub fn then(self, next: Self) -> Self
pub fn then(self, next: Self) -> Self
self followed by next, as one effect: opacities and scales multiply and
offsets add, the way two nested elements with these effects would look.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
True when applying the effect would change nothing.
Trait Implementations§
impl Copy for Effect
impl StructuralPartialEq for Effect
Auto Trait Implementations§
impl Freeze for Effect
impl RefUnwindSafe for Effect
impl Send for Effect
impl Sync for Effect
impl Unpin for Effect
impl UnsafeUnpin for Effect
impl UnwindSafe for Effect
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