HueRotateEffect
Turns every colour in the picture round the colour wheel – reds towards greens, greens towards blues - while leaving how light or dark it is unchanged.
public class HueRotateEffect : ShaderEffect
Inherits from / implements: ShaderEffect
Remarks
The rotation is the constant-brightness one SVG's hueRotate uses, so a light pixel
stays light. Animating Angle through a full turn sweeps the picture through the
spectrum and back to the original.
Settings
| Property | Range and default |
|---|---|
The turn, in radians: two pi (about 6.283) is a full turn back to the original. Default 2.0943951, a third of a turn. |
Examples
A logo that cycles slowly through the spectrum.
<Image Source="Images/logo.png"
xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
<Image.Effect>
<fx:HueRotateEffect x:Name="Hue" Angle="0" />
</Image.Effect>
<Image.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Hue" Storyboard.TargetProperty="Angle"
From="0" To="6.2831853" Duration="0:0:8" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>See also
Members at a glance
| Constructors | |
|---|---|
HueRotateEffect | Creates the effect with its default settings: Angle a third of a turn. |
| Properties | |
Angle | Gets or sets how far the colours are turned round the colour wheel. |
Input | Gets or sets the picture the effect works on. |
| Fields | |
AngleProperty | Identifies the Angle dependency property. |
InputProperty | Identifies the Input dependency property. |
Constructors
HueRotateEffect
Creates the effect with its default settings: Angle a third of a turn.
Properties
Angle
Gets or sets how far the colours are turned round the colour wheel.
- Value
- In radians: two pi (about 6.283) is a full turn back to the original, and a negative value turns the other way. The default is 2.0943951, a third of a turn, so the effect shows without configuration.
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
AngleProperty static
Identifies the Angle dependency property.
InputProperty static
Identifies the Input dependency property.