# WaterRippleShaderEffect

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/effects/library/struct-waterrippleshadereffect/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
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`](/docs/0.5.0/api/ferroui-base/media/effects/library/struct-interactivewaterrippleeffect/) makes ripples where the pointer is pressed,
dragged and released, and ages them on the frames of the animation clock.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L960)

## Members

- [`pointer_x`](#struct_field-pointer_x)
- [`pointer_y`](#struct_field-pointer_y)
- [`is_pointer_over`](#struct_field-is_pointer_over)
- [`is_pressed`](#struct_field-is_pressed)
- [`ripples`](#struct_field-ripples)
- [`distortion`](#struct_field-distortion)
- [`max_radius`](#struct_field-max_radius)
- [`ring_width`](#struct_field-ring_width)
- [`tint_strength`](#struct_field-tint_strength)
- [`color`](#struct_field-color)
- [`SAMPLE_RADIUS`](#assoc_const-sample_radius)
- [`has_active_ripples`](#function-has_active_ripples)
- [`spawn_ripple`](#function-spawn_ripple)

<a id="struct_field-pointer_x"></a>

### pointer_x

```rust
pointer_x: f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L963)

<a id="struct_field-pointer_y"></a>

### pointer_y

```rust
pointer_y: f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L966)

<a id="struct_field-is_pointer_over"></a>

### is_pointer_over

```rust
is_pointer_over: bool
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L968)

<a id="struct_field-is_pressed"></a>

### is_pressed

```rust
is_pressed: bool
```

Whether the pointer is pressed (default `false`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L970)

<a id="struct_field-ripples"></a>

### ripples

```rust
ripples: [RippleWave; 3]
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L972)

<a id="struct_field-distortion"></a>

### distortion

```rust
distortion: f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L975)

<a id="struct_field-max_radius"></a>

### max_radius

```rust
max_radius: f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L977)

<a id="struct_field-ring_width"></a>

### ring_width

```rust
ring_width: f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L979)

<a id="struct_field-tint_strength"></a>

### tint_strength

```rust
tint_strength: f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L981)

<a id="struct_field-color"></a>

### color

```rust
color: crate::media::Color
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L983)

<a id="assoc_const-sample_radius"></a>

### SAMPLE_RADIUS

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L1008)

<a id="function-has_active_ripples"></a>

### has_active_ripples

```rust
fn has_active_ripples(self: &Self) -> bool
```

Whether a ripple is there.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L1011)

<a id="function-spawn_ripple"></a>

### spawn_ripple

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/library/interactive.rs#L1017)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Default`
- [`CustomEffect`](/docs/0.5.0/api/ferroui-base/media/effects/trait-customeffect/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
