FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    WaterRippleShaderEffect

    struct · ferroui-base · v0.5.0

    struct WaterRippleShaderEffect
    

    Rings that spread over the content and bend it (Effector's WaterRippleShaderEffect): each of the three ripples a ring around its centre whose radius grows with its age to max-radius of the larger side (clamped to 0.2..0.95), ring-width of the smaller side wide (clamped to 0.02..0.18, at least 3 device independent pixels), fading as it ages; the content under a ring is moved outward by up to distortion device independent pixels (clamped to 0..18) and tinted towards the colour by tint-strength (clamped to 0..0.42). While the pointer is over the host or pressed, the content around (pointer-x, pointer-y) swells a little. The moved content is sampled clamped to the area and composed over the content masked by it, so the rings bend the content within its coverage only (transparent corners stay transparent).

    water-ripple(distortion=12, max-radius=0.72, ring-width=0.065, tint-strength=0.18, color=#7FD6FF); a ripple is ripple-1-center=0.5,0.5, ripple-1-age=0.3, ripple-1-strength=1. A content-sampling shader effect with a sample radius of 56; without ripples and with the pointer away (the default and the neutral value) the content is unchanged. InteractiveWaterRippleEffect makes ripples where the pointer is pressed, dragged and released, and ages them on the frames of the animation clock.

    View source

    Members

    pointer_x

    pointer_x: f64
    

    The horizontal position of the pointer, 0 (left) to 1 (right) (default 0.5).

    Source

    pointer_y

    pointer_y: f64
    

    The vertical position of the pointer, 0 (top) to 1 (bottom) (default 0.5).

    Source

    is_pointer_over

    is_pointer_over: bool
    

    Whether the pointer is over the host (default false).

    Source

    is_pressed

    is_pressed: bool
    

    Whether the pointer is pressed (default false).

    Source

    ripples

    ripples: [RippleWave; 3]
    

    The three ripples, the newest first (default none).

    Source

    distortion

    distortion: f64
    

    How far a ring moves the content, in device independent pixels (default 12).

    Source

    max_radius

    max_radius: f64
    

    How far a ring spreads, a fraction of the larger side (default 0.72).

    Source

    ring_width

    ring_width: f64
    

    The width of a ring, a fraction of the smaller side (default 0.065).

    Source

    tint_strength

    tint_strength: f64
    

    How far a ring tints the content towards the colour (default 0.18).

    Source

    color

    color: crate::media::Color
    

    The colour of the rings (default #7FD6FF).

    Source

    SAMPLE_RADIUS

    const SAMPLE_RADIUS: f64
    

    How far the program moves the content at most, in device independent pixels: the largest distortion (18) times the sum of the waves of the three rings (up to 3) and the swell under the pointer (1.25), rounded up (#580).

    Source

    has_active_ripples

    fn has_active_ripples(self: &Self) -> bool
    

    Whether a ripple is there.

    Source

    spawn_ripple

    fn spawn_ripple(self: &mut Self, center: Point, strength: f64)
    

    A new ripple at center of strength: the others move down, the oldest is dropped (Effector's SpawnRipple).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default
    • CustomEffect

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.