HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › RadialBlurEffect

RadialBlurEffect

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

Streaks the picture towards a centre point – the blur a camera leaves when it zooms during the exposure.

public class RadialBlurEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

Twelve samples are taken for each pixel, enough to read as a streak without banding at the strengths the effect is meant for. Animate BlurAmount down to zero for a zoom-in transition; move CenterXY to throw the streak off-centre.

Settings

PropertyRange and default

BlurAmount

Length of the streak, as a fraction of each pixel's distance from the centre. Default 0.2; 0 leaves the picture unchanged, 0.05 to 0.5 is the useful range.

CenterXY

Point the streaks converge on, in relative coordinates: (0,0) is the top-left corner of the element and (1,1) its bottom-right. Default (0.5,0.5).

Examples

A page that zooms into focus as it appears.

<Grid xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
    <Grid.Effect>
        <fx:RadialBlurEffect x:Name="Zoom" BlurAmount="0.6" />
    </Grid.Effect>
    <Grid.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Zoom" Storyboard.TargetProperty="BlurAmount"
                                     To="0" Duration="0:0:0.4" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Grid.Triggers>
    <!-- the page's content -->
</Grid>

See also

Members at a glance

Constructors
RadialBlurEffectCreates the effect with its default settings: BlurAmount 0.2, CenterXY (0.5,0.5).
Properties
BlurAmountGets or sets how long the streaks are.
CenterXYGets or sets the point the streaks converge on.
InputGets or sets the picture the effect works on.
Fields
BlurAmountPropertyIdentifies the BlurAmount dependency property.
CenterXYPropertyIdentifies the CenterXY dependency property.
InputPropertyIdentifies the Input dependency property.

Constructors

RadialBlurEffect

public RadialBlurEffect()

Creates the effect with its default settings: BlurAmount 0.2, CenterXY (0.5,0.5).

Properties

BlurAmount

public double BlurAmount

Gets or sets how long the streaks are.

Value
A fraction of each pixel's distance from CenterXY: 1 streaks all the way to it. The default is 0.2; 0 leaves the picture unchanged, 0.05 to 0.5 is the useful range, and a negative value streaks outwards instead.

CenterXY

public Point CenterXY

Gets or sets the point the streaks converge on.

Value
A point in relative coordinates: (0,0) is the top-left corner of the element and (1,1) its bottom-right. The default is (0.5,0.5), the middle.

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.

Fields

BlurAmountProperty static

public static readonly DependencyProperty BlurAmountProperty

Identifies the BlurAmount dependency property.

CenterXYProperty static

public static readonly DependencyProperty CenterXYProperty

Identifies the CenterXY dependency property.

InputProperty static

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.