Skip to main content

EffectExt

Trait EffectExt 

pub trait EffectExt: Sized {
    // Required method
    fn get_effect(&mut self) -> &mut EffectData;

    // Provided methods
    fn effect(self, effect: EffectData) -> Self { ... }
    fn overflow(self, overflow: impl Into<Overflow>) -> Self { ... }
    fn blur(self, blur: impl Into<f32>) -> Self { ... }
    fn rotation(self, rotation: impl Into<f32>) -> Self { ... }
    fn opacity(self, opacity: impl Into<f32>) -> Self { ... }
    fn scale(self, scale: impl Into<Scale>) -> Self { ... }
    fn transform_origin(
        self,
        transform_origin: impl Into<TransformOrigin>,
    ) -> Self { ... }
}
Expand description

Methods for visual effects applied to an element: clipping, blur, rotation, opacity and scale.

Required Methods§

fn get_effect(&mut self) -> &mut EffectData

Returns a mutable reference to the element’s effect data.

Provided Methods§

fn effect(self, effect: EffectData) -> Self

Replace all of the element’s effect data at once. See EffectData.

fn overflow(self, overflow: impl Into<Overflow>) -> Self

Set whether content overflowing the element’s bounds is clipped. See Overflow.

fn blur(self, blur: impl Into<f32>) -> Self

Apply a gaussian blur of the given radius to the element.

fn rotation(self, rotation: impl Into<f32>) -> Self

Rotate the element by the given angle in degrees.

fn opacity(self, opacity: impl Into<f32>) -> Self

Set the element’s opacity, from 0.0 (transparent) to 1.0 (opaque).

fn scale(self, scale: impl Into<Scale>) -> Self

Scale the element. See Scale.

fn transform_origin(self, transform_origin: impl Into<TransformOrigin>) -> Self

Set the point that the scale and rotation effects pivot around.

Defaults to the element’s center.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§