HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › KaleidoscopeEffect

KaleidoscopeEffect

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

Folds the picture into mirrored wedges round a centre point, the way a kaleidoscope folds whatever it is pointed at.

public class KaleidoscopeEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

Animate Rotation to turn the barrel: the pattern keeps its symmetry while the picture sweeps through it. Choose SegmentCount rather than animate it – a change re-cuts the wedges and reads as a jump.

Settings

PropertyRange and default

SegmentCount

Number of wedges. Default 6; values below 1 count as 1, a single mirror.

Rotation

Turn of the fold, in radians. Default 0.

CenterXY

Point the wedges meet at, 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

<Image Source="Photos/flowers.jpg"
       xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
    <Image.Effect>
        <fx:KaleidoscopeEffect SegmentCount="8" Rotation="0.4" />
    </Image.Effect>
</Image>

See also

Members at a glance

Constructors
KaleidoscopeEffectCreates the effect with its default settings: SegmentCount 6, Rotation 0, CenterXY (0.5,0.5).
Properties
CenterXYGets or sets the point the wedges meet at.
InputGets or sets the picture the effect works on.
RotationGets or sets how far the fold is turned.
SegmentCountGets or sets how many mirrored wedges the picture is folded into.
Fields
CenterXYPropertyIdentifies the CenterXY dependency property.
InputPropertyIdentifies the Input dependency property.
RotationPropertyIdentifies the Rotation dependency property.
SegmentCountPropertyIdentifies the SegmentCount dependency property.

Constructors

KaleidoscopeEffect

public KaleidoscopeEffect()

Creates the effect with its default settings: SegmentCount 6, Rotation 0, CenterXY (0.5,0.5).

Properties

CenterXY

public Point CenterXY

Gets or sets the point the wedges meet at.

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.

Rotation

public double Rotation

Gets or sets how far the fold is turned.

Value
In radians; the default is 0. Animate it to rotate the pattern.

SegmentCount

public double SegmentCount

Gets or sets how many mirrored wedges the picture is folded into.

Value
The default is 6. Values below 1 count as 1, which gives a single mirror line through CenterXY. Whole numbers give even wedges.

Fields

CenterXYProperty static

public static readonly DependencyProperty CenterXYProperty

Identifies the CenterXY dependency property.

InputProperty static

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.

RotationProperty static

public static readonly DependencyProperty RotationProperty

Identifies the Rotation dependency property.

SegmentCountProperty static

public static readonly DependencyProperty SegmentCountProperty

Identifies the SegmentCount dependency property.