HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › WaterWaveEffect

WaterWaveEffect

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Shaders.Library.CustomEffects

Wobbles the picture in fine waves across and down it, as if seen through moving water or heat haze.

public class WaterWaveEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

There are about thirty waves across the element. WaveFactor sets how far they push the picture; animate it to make the picture swell and settle. ColorFilter is accepted but is not used by the shader, so it does not change the picture.

Settings

PropertyRange and default

WaveFactor

How far the waves displace the picture, as a fraction of the element. Default 0.03; 0 leaves it unchanged, 0.002 to 0.03 is the useful range.

ColorFilter

Not used by the shader. Default yellow.

Examples

A gentle, continuous shimmer.

<Image Source="Photos/lake.jpg"
       xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
    <Image.Effect>
        <fx:WaterWaveEffect x:Name="Haze" WaveFactor="0" />
    </Image.Effect>
    <Image.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Haze" Storyboard.TargetProperty="WaveFactor"
                                     To="0.006" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Image.Triggers>
</Image>

See also

Members at a glance

Constructors
WaterWaveEffectCreates the effect with its default settings: WaveFactor 0.03.
Properties
ColorFilterGets or sets a tint colour that the shader does not use.
InputGets or sets the picture the effect works on.
WaveFactorGets or sets how strongly the waves displace the picture.
Fields
ColorFilterPropertyIdentifies the ColorFilter dependency property.
InputPropertyIdentifies the Input dependency property.
WaveFactorPropertyIdentifies the WaveFactor dependency property.

Constructors

WaterWaveEffect

public WaterWaveEffect()

Creates the effect with its default settings: WaveFactor 0.03.

Properties

ColorFilter

public Color ColorFilter

Gets or sets a tint colour that the shader does not use.

Value
The default is Colors.Yellow. Setting it has no visible effect.

Input

public Brush Input

Gets or sets the picture the effect works on.

Value
A brush. The default is the element the effect is applied to, as WPF renders it – the effect's implicit input.
Remarks

Leave it unset in the usual case, where the effect is set as an element's Effect. Set it to a ImageBrush or VisualBrush to have the effect work on that picture instead.

WaveFactor

public double WaveFactor

Gets or sets how strongly the waves displace the picture.

Value
A fraction of the element's size; the default is 0.03, a strong wobble. 0 leaves the picture unchanged, and 0.002 to 0.03 is the useful range.

Fields

ColorFilterProperty static

public static readonly DependencyProperty ColorFilterProperty

Identifies the ColorFilter dependency property.

InputProperty static

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.

WaveFactorProperty static

public static readonly DependencyProperty WaveFactorProperty

Identifies the WaveFactor dependency property.