├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE
├── Libs
└── Microsoft.Expression.Effects.dll
├── README.md
├── Screenshots
├── 1.gif
├── 2.gif
├── 3.gif
└── 4.gif
├── Settings.XamlStyler
├── WpfDesignAndAnimationLab.Effects
├── ClipEffect.cs
├── DeepShadowEffect.cs
├── FakeDropShadowEffect.cs
├── GlowEffect.cs
├── HorizontalLightenEffect.cs
├── LightenEffect.cs
├── LongShadowEffect.cs
├── OpacityThresholdEffect.cs
├── Shaders
│ ├── Clip.fx
│ ├── ClipEffect.ps
│ ├── DeepShadow.fx
│ ├── DeepShadowEffect.ps
│ ├── FakeDropShadow.fx
│ ├── FakeDropShadow.ps
│ ├── Glow.fx
│ ├── GlowEffect.ps
│ ├── HorizontalLighten.fx
│ ├── HorizontalLightenEffect.ps
│ ├── Lighten.fx
│ ├── LightenEffect.ps
│ ├── LongShadow.fx
│ ├── LongShadowEffect.ps
│ ├── OpacityThreshold.fx
│ ├── OpacityThresholdEffect.ps
│ ├── SmoothOpacityThreshold.fx
│ └── SmoothOpacityThresholdEffect.ps
├── SmoothOpacityThresholdEffect.cs
└── WpfDesignAndAnimationLab.Effects.csproj
├── WpfDesignAndAnimationLab.sln
├── WpfDesignAndAnimationLab.sln.DotSettings
└── WpfDesignAndAnimationLab
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── Assets
├── Images
│ ├── BingWallpaper.jpg
│ ├── hero_iphone_14_pro.jpg
│ └── windows.jpg
├── OstrichSans-Light.otf
├── VGAFIX.FON
├── fixedsys.ttf
└── hooge-0857.ttf
├── Behaviors
├── ChangeAngleToEnterPointerBehavior.cs
├── ClipBehavior.cs
├── EllipseProgressBehavior.cs
├── PathProgressBehavior.cs
├── ProgressToEllipseBehavior.cs
└── ProgressToHeightBehavior.cs
├── Common
├── AnimateDoubleWrapper.cs
├── AnimatePointWrapper.cs
├── ColorHelper.cs
├── DoubleIncreaser.cs
├── DoubleWrapper.cs
├── DurationIncreaser.cs
├── GeometryCreator.cs
├── HslColor.cs
├── HsvColor.cs
├── Increaser.cs
├── ProgressWrapper.cs
├── RandomColorCreator.cs
├── RandomCreator.cs
├── RandomDoubleCreator.cs
├── RepeatCollection.cs
├── SelectorIndicatorHelper.cs
├── Switcher.cs
├── TimeSpanIncreaser.cs
├── TimeSpanWrapper.cs
├── ValueWrapper.cs
├── VisualStates.cs
└── VisualTreeHelperEx.cs
├── Controls
├── ActivationContentControl.cs
├── ActivationContentControl.xaml
├── AlignmentGrid.cs
├── BusyIndicator.cs
├── BusyIndicator.xaml
├── Direction.cs
├── InnerShadowBox.cs
├── InnerShadowBox.xaml
├── NeuomorphismBox.cs
├── NeuomorphismBox.xaml
├── NeuomorphismBoxTemplateSettings.cs
├── NeuomorphismLightSource.cs
├── NeuomorphismShape.cs
├── ProgressRing.cs
├── ProgressRing.xaml
├── SelectorIndicator.cs
├── SelectorIndicator.xaml
├── ShadowChrome.cs
├── TemplateSettingValues.cs
├── Triangle.cs
├── WobbleContentControl.cs
└── WobbleContentControl.xaml
├── Converters
├── FontWeightConverter.cs
├── LightenConverter.cs
├── ProgressBarWidthConverter.cs
├── ProgressToHeightConverter.cs
├── RGBToSRGBColorConverter.cs
└── ReverseProgressToHeightConverter.cs
├── Demos
├── Activation
│ ├── ActivationDemo1.xaml
│ └── ActivationDemo1.xaml.cs
├── AnimateProgressRing
│ ├── AnimateProgressRing.cs
│ ├── AnimateProgressRing.xaml
│ ├── AnimateProgressRingUsingControlTemplate.xaml
│ ├── AnimateProgressRingUsingControlTemplate.xaml.cs
│ ├── HardCodeAnimateProgressRing.xaml
│ └── HardCodeAnimateProgressRing.xaml.cs
├── ArcProgresses
│ ├── ArcProgressAnimationDemo.xaml
│ ├── ArcProgressAnimationDemo.xaml.cs
│ ├── ArcProgressDemo.xaml
│ ├── ArcProgressDemo.xaml.cs
│ ├── ArcProgressDesignDemo.xaml
│ └── ArcProgressDesignDemo.xaml.cs
├── BorderAnimations
│ ├── UserControl1.xaml
│ └── UserControl1.xaml.cs
├── Buttons
│ ├── ButtonDesignDemo1.xaml
│ ├── ButtonDesignDemo1.xaml.cs
│ ├── ButtonDesignDemo2.xaml
│ ├── ButtonDesignDemo2.xaml.cs
│ ├── ButtonDesignDemo3.xaml
│ └── ButtonDesignDemo3.xaml.cs
├── ColorWheel
│ ├── ColorWheelDemo.xaml
│ ├── ColorWheelDemo.xaml.cs
│ ├── UserControl1.xaml
│ └── UserControl1.xaml.cs
├── ColumnProgressBars
│ ├── ColumnProgressBarDemo.xaml
│ └── ColumnProgressBarDemo.xaml.cs
├── Effects
│ ├── FakeDropShadowDemo.xaml
│ ├── FakeDropShadowDemo.xaml.cs
│ ├── InnerShadowEffectDemo.xaml
│ ├── InnerShadowEffectDemo.xaml.cs
│ ├── LightenDemo.xaml
│ ├── LightenDemo.xaml.cs
│ ├── LightenDemoItem.xaml
│ └── LightenDemoItem.xaml.cs
├── FancyTexts
│ ├── FancyText.cs
│ ├── FancyTextDemoPage.xaml
│ └── FancyTextDemoPage.xaml.cs
├── GlowEffects
│ ├── GlowEffectDemo1.xaml
│ ├── GlowEffectDemo1.xaml.cs
│ ├── GlowLineDemo.xaml
│ ├── GlowLineDemo.xaml.cs
│ ├── GlowTextDemo.xaml
│ ├── GlowTextDemo.xaml.cs
│ ├── NeonLoveDemo.xaml
│ └── NeonLoveDemo.xaml.cs
├── Gooey
│ ├── GooeyDemo.xaml
│ ├── GooeyDemo.xaml.cs
│ ├── GooeyEllipseDemo.xaml
│ ├── GooeyEllipseDemo.xaml.cs
│ ├── GooeyImageDemo.xaml
│ ├── GooeyImageDemo.xaml.cs
│ ├── GooeyRectangleDemo.xaml
│ ├── GooeyRectangleDemo.xaml.cs
│ ├── TextMorph2Demo.xaml
│ ├── TextMorph2Demo.xaml.cs
│ ├── TextMorphDemo.xaml
│ └── TextMorphDemo.xaml.cs
├── InnerShadows
│ ├── InnerShadowDemo.xaml
│ ├── InnerShadowDemo.xaml.cs
│ ├── PathInnerShadowDemo.xaml
│ ├── PathInnerShadowDemo.xaml.cs
│ ├── VariableSizeInnerShadowDemo.xaml
│ └── VariableSizeInnerShadowDemo.xaml.cs
├── ItemsControls
│ ├── IndicatorDemo.xaml
│ ├── IndicatorDemo.xaml.cs
│ ├── RadioButtonsIndicatorDemo.xaml
│ └── RadioButtonsIndicatorDemo.xaml.cs
├── LongShadows
│ ├── LongShadowDemo1.xaml
│ ├── LongShadowDemo1.xaml.cs
│ ├── LongShadowDemo2.xaml
│ ├── LongShadowDemo2.xaml.cs
│ ├── LongShadowDemo3.xaml
│ ├── LongShadowDemo3.xaml.cs
│ ├── LongShadowDemo4.xaml
│ ├── LongShadowDemo4.xaml.cs
│ ├── LongShadowDemo5.xaml
│ ├── LongShadowDemo5.xaml.cs
│ └── text.png
├── Neuomorphism
│ ├── NeuomorphismButtonDemo.xaml
│ ├── NeuomorphismButtonDemo.xaml.cs
│ ├── NeuomorphismPanel.xaml
│ ├── NeuomorphismPanel.xaml.cs
│ ├── NeuomorphismPanelDemo.xaml
│ └── NeuomorphismPanelDemo.xaml.cs
├── NintendoSwitchLoadings
│ ├── NintendoEShopLoading.xaml
│ ├── NintendoEShopLoading.xaml.cs
│ ├── NintendoEShopLoadingRow.xaml
│ ├── NintendoEShopLoadingRow.xaml.cs
│ ├── NintendoEShopLoadingRowUsingEffect.xaml
│ ├── NintendoEShopLoadingRowUsingEffect.xaml.cs
│ ├── NintendoEShopLoadingUsingEffect.xaml
│ ├── NintendoEShopLoadingUsingEffect.xaml.cs
│ ├── NintendoSwitchLoading.xaml
│ └── NintendoSwitchLoading.xaml.cs
├── OutlinedText
│ ├── ButtonDemo1.xaml
│ ├── ButtonDemo1.xaml.cs
│ ├── ButtonDemo2.xaml
│ ├── ButtonDemo2.xaml.cs
│ ├── ButtonDemo3.xaml
│ ├── ButtonDemo3.xaml.cs
│ ├── Demo1Page.xaml
│ ├── Demo1Page.xaml.cs
│ ├── Demo5Page.xaml
│ ├── Demo5Page.xaml.cs
│ ├── Demo6Page.xaml
│ ├── Demo6Page.xaml.cs
│ ├── Demo7Page.xaml
│ ├── Demo7Page.xaml.cs
│ ├── Demo8Page.xaml
│ ├── Demo8Page.xaml.cs
│ ├── InnerOutlinedTextControl.cs
│ ├── OutlinedTextButtonDemo.xaml
│ ├── OutlinedTextButtonDemo.xaml.cs
│ ├── OutlinedTextControl.cs
│ ├── OutlinedTextControl.xaml
│ ├── OutlinedTextDemoPage.xaml
│ └── OutlinedTextDemoPage.xaml.cs
├── ProgressAndLoading
│ ├── ProgressDemo1.xaml
│ └── ProgressDemo1.xaml.cs
├── ProgressRings
│ ├── LinearGradientCircleLoading.xaml
│ ├── LinearGradientCircleLoading.xaml.cs
│ ├── LinearGradientFullCircleLoading.xaml
│ ├── LinearGradientFullCircleLoading.xaml.cs
│ ├── ProgressRingBasicDemo.xaml
│ └── ProgressRingBasicDemo.xaml.cs
├── RainbowButtons
│ ├── RainbowAppleButton.xaml
│ ├── RainbowAppleButton.xaml.cs
│ ├── RainbowAppleButtonWithGlow.xaml
│ └── RainbowAppleButtonWithGlow.xaml.cs
├── RainbowTexts
│ ├── RainbowTextDemo1.xaml
│ ├── RainbowTextDemo1.xaml.cs
│ ├── RainbowTextWithAnimation.xaml
│ ├── RainbowTextWithAnimation.xaml.cs
│ ├── RainbowTextWithRandom.xaml
│ ├── RainbowTextWithRandom.xaml.cs
│ ├── RainbowTextWithWave.xaml
│ └── RainbowTextWithWave.xaml.cs
├── ScaleMarks
│ ├── DenseDemo.xaml
│ ├── DenseDemo.xaml.cs
│ ├── ScaleMarkDemo.xaml
│ ├── ScaleMarkDemo.xaml.cs
│ ├── ScaleMarkDemoUsingArcPanel.xaml
│ ├── ScaleMarkDemoUsingArcPanel.xaml.cs
│ ├── ScaleMarkDemoUsingEllipse.xaml
│ └── ScaleMarkDemoUsingEllipse.xaml.cs
├── Shadows
│ ├── DropShadowColorDemo.xaml
│ ├── DropShadowColorDemo.xaml.cs
│ ├── DropShadowDemo.xaml
│ └── DropShadowDemo.xaml.cs
├── Shapes
│ ├── EllipseButtonDemo.xaml
│ ├── EllipseButtonDemo.xaml.cs
│ ├── PointsAnimation.xaml
│ ├── PointsAnimation.xaml.cs
│ ├── ProgressToPointCollectionBridge.cs
│ ├── TriangleLoading.xaml
│ ├── TriangleLoading.xaml.cs
│ ├── TriangleLoading2.xaml
│ ├── TriangleLoading2.xaml.cs
│ ├── TriangleLoading3.xaml
│ └── TriangleLoading3.xaml.cs
├── TextAndShadows
│ ├── ChildrenAnimationHelper.cs
│ ├── TextAndShadowDemo1.xaml
│ ├── TextAndShadowDemo1.xaml.cs
│ ├── TextAndShadowDemo2.xaml
│ └── TextAndShadowDemo2.xaml.cs
├── TextAnimations
│ ├── iPhone14ProTextAnimation.xaml
│ └── iPhone14ProTextAnimation.xaml.cs
├── TextEffects
│ ├── TextEffectsBasicDemo.xaml
│ └── TextEffectsBasicDemo.xaml.cs
├── TextShapes
│ ├── TextShapeDemo1Page.xaml
│ ├── TextShapeDemo1Page.xaml.cs
│ ├── TextShapeDemo2Page.xaml
│ ├── TextShapeDemo2Page.xaml.cs
│ ├── TextShapeDemo3Page.xaml
│ ├── TextShapeDemo3Page.xaml.cs
│ ├── VariableFont1Page.xaml
│ ├── VariableFont1Page.xaml.cs
│ ├── VariableFont2Page.xaml
│ ├── VariableFont2Page.xaml.cs
│ ├── VariableFont3Page.xaml
│ ├── VariableFont3Page.xaml.cs
│ ├── VariableFont4Page.xaml
│ ├── VariableFont4Page.xaml.cs
│ ├── VariableFont5Page.xaml
│ ├── VariableFont5Page.xaml.cs
│ ├── VariableFont6Page.xaml
│ └── VariableFont6Page.xaml.cs
├── TextShimmers
│ ├── TextShimmerUsingOpacityMask.xaml
│ └── TextShimmerUsingOpacityMask.xaml.cs
├── Transitions
│ ├── RippleBasic.xaml
│ ├── RippleBasic.xaml.cs
│ ├── TransitionBusyIndicatorDemo.xaml
│ └── TransitionBusyIndicatorDemo.xaml.cs
├── WaveProgressBars
│ ├── HardCodeWaveProgressBar.xaml
│ ├── HardCodeWaveProgressBar.xaml.cs
│ ├── WaveProgressBar.cs
│ ├── WaveProgressBar.xaml
│ ├── WaveProgressBarUsingControlTemplate.xaml
│ └── WaveProgressBarUsingControlTemplate.xaml.cs
├── Waves
│ ├── SimpleBezierWave.xaml
│ ├── SimpleBezierWave.xaml.cs
│ ├── SimpleBubbleWaves.xaml
│ ├── SimpleBubbleWaves.xaml.cs
│ ├── SimpleWaves.xaml
│ └── SimpleWaves.xaml.cs
└── Wobble
│ ├── WobbleDemo1.xaml
│ └── WobbleDemo1.xaml.cs
├── Extensions
└── LightenExtension.cs
├── Infrastructure
├── DemoContainer.xaml
├── DemoContainer.xaml.cs
├── DemoPage.cs
├── ExampleDefinition.cs
└── ExampleDefinitions.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Media
├── Direction.cs
├── HslColor.cs
├── ShapeStrokeHelper.cs
├── TextShape.cs
└── Triangle.cs
├── Themes
├── Generic.xaml
└── Styles.xaml
└── WpfDesignAndAnimationLab.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Dino Chan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Libs/Microsoft.Expression.Effects.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/Libs/Microsoft.Expression.Effects.dll
--------------------------------------------------------------------------------
/Screenshots/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/Screenshots/1.gif
--------------------------------------------------------------------------------
/Screenshots/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/Screenshots/2.gif
--------------------------------------------------------------------------------
/Screenshots/3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/Screenshots/3.gif
--------------------------------------------------------------------------------
/Screenshots/4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/Screenshots/4.gif
--------------------------------------------------------------------------------
/Settings.XamlStyler:
--------------------------------------------------------------------------------
1 | {
2 | "AttributesTolerance": 2,
3 | "KeepFirstAttributeOnSameLine": true,
4 | "MaxAttributeCharactersPerLine": 0,
5 | "MaxAttributesPerLine": 1,
6 | "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
7 | "SeparateByGroups": false,
8 | "AttributeIndentation": 0,
9 | "AttributeIndentationStyle": 1,
10 | "RemoveDesignTimeReferences": false,
11 | "EnableAttributeReordering": true,
12 | "AttributeOrderingRuleGroups": [
13 | "x:Class",
14 | "xmlns, xmlns:x",
15 | "xmlns:*",
16 | "x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
17 | "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
18 | "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
19 | "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
20 | "*:*, *",
21 | "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
22 | "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
23 | "Storyboard.*, From, To, Duration"
24 | ],
25 | "FirstLineAttributes": "",
26 | "OrderAttributesByName": true,
27 | "PutEndingBracketOnNewLine": false,
28 | "RemoveEndingTagOfEmptyElement": true,
29 | "SpaceBeforeClosingSlash": true,
30 | "RootElementLineBreakRule": 0,
31 | "ReorderVSM": 0,
32 | "ReorderGridChildren": false,
33 | "ReorderCanvasChildren": false,
34 | "ReorderSetters": 0,
35 | "FormatMarkupExtension": true,
36 | "NoNewLineMarkupExtensions": "x:Bind, Binding",
37 | "ThicknessSeparator": 2,
38 | "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
39 | "FormatOnSave": true,
40 | "CommentPadding": 2,
41 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/ClipEffect.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // ?????????
4 | // ?????:4.0.30319.42000
5 | //
6 | // ???????????????????????
7 | // ????????????????
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Windows;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Effects;
15 | using System.Windows.Media.Media3D;
16 |
17 |
18 | namespace WpfDesignAndAnimationLab.Effects {
19 |
20 | public class ClipEffect : ShaderEffect {
21 | public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(ClipEffect), 0);
22 | public static readonly DependencyProperty BlendProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Blend", typeof(ClipEffect), 1);
23 | public ClipEffect() {
24 | PixelShader pixelShader = new PixelShader();
25 | pixelShader.UriSource = new Uri("/WpfDesignAndAnimationLab.Effects;component/Shaders/ClipEffect.ps", UriKind.Relative);
26 | this.PixelShader = pixelShader;
27 |
28 | this.UpdateShaderValue(InputProperty);
29 | this.UpdateShaderValue(BlendProperty);
30 | }
31 | public Brush Input {
32 | get {
33 | return ((Brush)(this.GetValue(InputProperty)));
34 | }
35 | set {
36 | this.SetValue(InputProperty, value);
37 | }
38 | }
39 | public Brush Blend {
40 | get {
41 | return ((Brush)(this.GetValue(BlendProperty)));
42 | }
43 | set {
44 | this.SetValue(BlendProperty, value);
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/GlowEffect.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // ?????????
4 | // ?????:4.0.30319.42000
5 | //
6 | // ???????????????????????
7 | // ????????????????
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Windows;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Effects;
15 | using System.Windows.Media.Media3D;
16 |
17 |
18 | namespace WpfDesignAndAnimationLab.Effects {
19 |
20 | public class GlowEffect : ShaderEffect {
21 | public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(GlowEffect), 0);
22 | public static readonly DependencyProperty AmountProperty = DependencyProperty.Register("Amount", typeof(double), typeof(GlowEffect), new UIPropertyMetadata(((double)(1D)), PixelShaderConstantCallback(0)));
23 | public GlowEffect() {
24 | PixelShader pixelShader = new PixelShader();
25 | pixelShader.UriSource = new Uri("/WpfDesignAndAnimationLab.Effects;component/Shaders/GlowEffect.ps", UriKind.Relative);
26 | this.PixelShader = pixelShader;
27 |
28 | this.UpdateShaderValue(InputProperty);
29 | this.UpdateShaderValue(AmountProperty);
30 | }
31 | public Brush Input {
32 | get {
33 | return ((Brush)(this.GetValue(InputProperty)));
34 | }
35 | set {
36 | this.SetValue(InputProperty, value);
37 | }
38 | }
39 | /// ShadowLength.
40 | public double Amount {
41 | get {
42 | return ((double)(this.GetValue(AmountProperty)));
43 | }
44 | set {
45 | this.SetValue(AmountProperty, value);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/HorizontalLightenEffect.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // ?????????
4 | // ?????:4.0.30319.42000
5 | //
6 | // ???????????????????????
7 | // ????????????????
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Windows;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Effects;
15 | using System.Windows.Media.Media3D;
16 |
17 |
18 | namespace WpfDesignAndAnimationLab.Effects {
19 |
20 | public class HorizontalLightenEffect : ShaderEffect {
21 | public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(HorizontalLightenEffect), 0);
22 | public static readonly DependencyProperty LeftProperty = DependencyProperty.Register("Left", typeof(double), typeof(HorizontalLightenEffect), new UIPropertyMetadata(((double)(0D)), PixelShaderConstantCallback(0)));
23 | public static readonly DependencyProperty RightProperty = DependencyProperty.Register("Right", typeof(double), typeof(HorizontalLightenEffect), new UIPropertyMetadata(((double)(0D)), PixelShaderConstantCallback(1)));
24 | public static readonly DependencyProperty CenterProperty = DependencyProperty.Register("Center", typeof(double), typeof(HorizontalLightenEffect), new UIPropertyMetadata(((double)(0D)), PixelShaderConstantCallback(2)));
25 | public HorizontalLightenEffect() {
26 | PixelShader pixelShader = new PixelShader();
27 | pixelShader.UriSource = new Uri("/WpfDesignAndAnimationLab.Effects;component/Shaders/HorizontalLightenEffect.ps", UriKind.Relative);
28 | this.PixelShader = pixelShader;
29 |
30 | this.UpdateShaderValue(InputProperty);
31 | this.UpdateShaderValue(LeftProperty);
32 | this.UpdateShaderValue(RightProperty);
33 | this.UpdateShaderValue(CenterProperty);
34 | }
35 | public Brush Input {
36 | get {
37 | return ((Brush)(this.GetValue(InputProperty)));
38 | }
39 | set {
40 | this.SetValue(InputProperty, value);
41 | }
42 | }
43 | public double Left {
44 | get {
45 | return ((double)(this.GetValue(LeftProperty)));
46 | }
47 | set {
48 | this.SetValue(LeftProperty, value);
49 | }
50 | }
51 | public double Right {
52 | get {
53 | return ((double)(this.GetValue(RightProperty)));
54 | }
55 | set {
56 | this.SetValue(RightProperty, value);
57 | }
58 | }
59 | public double Center {
60 | get {
61 | return ((double)(this.GetValue(CenterProperty)));
62 | }
63 | set {
64 | this.SetValue(CenterProperty, value);
65 | }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/LightenEffect.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Windows;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Effects;
15 | using System.Windows.Media.Media3D;
16 |
17 |
18 | namespace WpfDesignAndAnimationLab.Effects
19 | {
20 |
21 | public class LightenEffect : ShaderEffect
22 | {
23 | public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(LightenEffect), 0);
24 | public static readonly DependencyProperty DeltaProperty = DependencyProperty.Register("Delta", typeof(double), typeof(LightenEffect), new UIPropertyMetadata(((double)(0D)), PixelShaderConstantCallback(0)));
25 | public LightenEffect()
26 | {
27 | PixelShader pixelShader = new PixelShader();
28 | pixelShader.UriSource = new Uri("/WpfDesignAndAnimationLab.Effects;component/Shaders/LightenEffect.ps", UriKind.Relative);
29 | this.PixelShader = pixelShader;
30 |
31 | this.UpdateShaderValue(InputProperty);
32 | this.UpdateShaderValue(DeltaProperty);
33 | }
34 | private Brush Input
35 | {
36 | get
37 | {
38 | return ((Brush)(this.GetValue(InputProperty)));
39 | }
40 | set
41 | {
42 | this.SetValue(InputProperty, value);
43 | }
44 | }
45 | public double Delta
46 | {
47 | get
48 | {
49 | return ((double)(this.GetValue(DeltaProperty)));
50 | }
51 | set
52 | {
53 | this.SetValue(DeltaProperty, value);
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/OpacityThresholdEffect.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // ?????????
4 | // ?????:4.0.30319.42000
5 | //
6 | // ???????????????????????
7 | // ????????????????
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Windows;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Effects;
15 | using System.Windows.Media.Media3D;
16 |
17 |
18 | namespace WpfDesignAndAnimationLab.Effects {
19 |
20 | public class OpacityThresholdEffect : ShaderEffect {
21 | public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(OpacityThresholdEffect), 0);
22 | public static readonly DependencyProperty ThreshProperty = DependencyProperty.Register("Thresh", typeof(double), typeof(OpacityThresholdEffect), new UIPropertyMetadata(((double)(3.5D)), PixelShaderConstantCallback(0)));
23 | public OpacityThresholdEffect() {
24 | PixelShader pixelShader = new PixelShader();
25 | pixelShader.UriSource = new Uri("/WpfDesignAndAnimationLab.Effects;component/Shaders/OpacityThresholdEffect.ps", UriKind.Relative);
26 | this.PixelShader = pixelShader;
27 |
28 | this.UpdateShaderValue(InputProperty);
29 | this.UpdateShaderValue(ThreshProperty);
30 | }
31 | public Brush Input {
32 | get {
33 | return ((Brush)(this.GetValue(InputProperty)));
34 | }
35 | set {
36 | this.SetValue(InputProperty, value);
37 | }
38 | }
39 | public double Thresh {
40 | get {
41 | return ((double)(this.GetValue(ThreshProperty)));
42 | }
43 | set {
44 | this.SetValue(ThreshProperty, value);
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/Clip.fx:
--------------------------------------------------------------------------------
1 | sampler2D input : register(s0);
2 | sampler2D blend : register(s1);
3 |
4 | float4 main(float2 uv : TEXCOORD) : COLOR
5 | {
6 | float4 inputColor = tex2D(input, uv);
7 | float4 blendColor = tex2D(blend, uv);
8 | float4 resultColor = 0;
9 | float opacity = inputColor.a - blendColor.a;
10 | resultColor.rgb = inputColor.rgb * opacity;
11 | resultColor.a = opacity;
12 |
13 | return resultColor;
14 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/ClipEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/ClipEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/DeepShadow.fx:
--------------------------------------------------------------------------------
1 | sampler2D input : register(s0);
2 |
3 | // new HLSL shader
4 | // modify the comment parameters to reflect your shader parameters
5 |
6 | /// Explain the purpose of this variable.
7 | /// 05/minValue>
8 | /// 10
9 | /// 3.5
10 | float SampleInputParam : register(C0);
11 |
12 | float4 main(float2 uv : TEXCOORD) : COLOR
13 | {
14 | float4 color;
15 | color = tex2D(input , uv.xy);
16 |
17 | return color;
18 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/DeepShadowEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/DeepShadowEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/FakeDropShadow.fx:
--------------------------------------------------------------------------------
1 | /// DirectionalBlurEffect
2 | /// An effect that blurs in a single direction.
3 | sampler2D Texture1Sampler : register(S0);
4 | //-----------------------------------------------------------------------------------------
5 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.)
6 | //-----------------------------------------------------------------------------------------
7 |
8 | /// The direction of the blur (in degrees).
9 | /// 0
10 | /// 360
11 | /// 0
12 | float Angle : register(C0);
13 |
14 | /// 0
15 | /// 1
16 | /// 0.0
17 | float Depth : register(C1);
18 |
19 | /// Opacity.
20 | /// 0
21 | /// 1
22 | /// 1
23 | float Opacity : register(C2);
24 |
25 | /// Color.
26 | /// Black
27 | float4 Color : register(C3);
28 |
29 | float4 main(float2 uv : TEXCOORD) : COLOR
30 | {
31 | float4 c = 0;
32 | float rad = Angle * 0.0174533f;
33 | float xOffset = cos(rad) * Depth;
34 | float yOffset = sin(rad) * Depth;
35 |
36 | uv.x += xOffset;
37 | uv.y += yOffset;
38 | c = tex2D(Texture1Sampler, uv);
39 | c.rgb = Color.rgb * c.a * Opacity;
40 | c.a = c.a * Opacity;
41 | return c;
42 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/FakeDropShadow.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/FakeDropShadow.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/Glow.fx:
--------------------------------------------------------------------------------
1 | sampler2D input : register(s0);
2 |
3 | /// Amount.
4 | /// 0
5 | /// 10
6 | /// 1
7 | float Amount : register(C0);
8 |
9 | float4 main(float2 uv : TEXCOORD) : COLOR
10 | {
11 | float4 srcColor = tex2D(input, uv);
12 |
13 | srcColor.rgb *= Amount;
14 | srcColor.a *= Amount;
15 | //srcColor.a=min(1,srcColor.a);
16 | return srcColor;
17 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/GlowEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/GlowEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/HorizontalLighten.fx:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marcus Schweda
2 | // This file is licensed under the MIT license (see LICENSE)
3 |
4 | sampler2D input : register(s0);
5 |
6 | float left : register(c0);
7 | float right : register(c1);
8 | float center : register(C2);
9 | // RGB -> HSL
10 | float4 hsl(float4 c) {
11 | float4 c2 = c.a;
12 | float M = max(c.r, max(c.g, c.b)),
13 | m = min(c.r, min(c.g, c.b));
14 | float chroma = M - m;
15 | // Lightness
16 | c2[2] = (M + m) / 2;
17 | // Hue
18 | if (chroma != 0) {
19 | if (M == c.r)
20 | c2[0] = ((c.g - c.b) / chroma) % 6;
21 | else if (M == c.g)
22 | c2[0] = (c.b - c.r) / chroma + 2;
23 | else
24 | c2[0] = (c.r - c.g) / chroma + 4;
25 | if (c2[0] < 0)
26 | c2[0] += 6;
27 | // Saturation
28 | c2[1] = chroma / (1 - abs(2 * c2[2] - 1));
29 | }
30 | else {
31 | c2[0] = c2[1] = 0;
32 | }
33 | return c2;
34 | }
35 |
36 | float4 rgb(float4 c) {
37 | float4 c2 = c[3];
38 | float chroma = c[1] * (1 - abs(2 * c[2] - 1));
39 | float X = chroma * (1 - abs(c[0] % 2 - 1));
40 |
41 | if (0 <= c[0] && c[0] < 1)
42 | c2.rgb = float3(chroma, X, 0);
43 | else if (1 <= c[0] && c[0] < 2)
44 | c2.rgb = float3(X, chroma, 0);
45 | else if (2 <= c[0] && c[0] < 3)
46 | c2.rgb = float3(0, chroma, X);
47 | else if (3 <= c[0] && c[0] < 4)
48 | c2.rgb = float3(0, X, chroma);
49 | else if (4 <= c[0] && c[0] < 5)
50 | c2.rgb = float3(X, 0, chroma);
51 | else if (5 <= c[0] && c[0] < 6)
52 | c2.rgb = float3(chroma, 0, X);
53 |
54 | c2.rgb += c[2] - chroma / 2;
55 | return c2;
56 | }
57 |
58 | float4 main(float2 uv : TEXCOORD) : COLOR{
59 | float4 hcyin = hsl(tex2D(input, uv));
60 | float delta = left;
61 | if (uv.x > center)
62 | {
63 | delta = right;
64 | }
65 |
66 | if (delta > 0)
67 | {
68 | hcyin[2] = saturate(hcyin[2] + (1 - hcyin[2]) * delta);
69 | }
70 | else
71 | {
72 | hcyin[2] = saturate(hcyin[2] + hcyin[2] * delta);
73 | }
74 |
75 | return rgb(hcyin);
76 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/HorizontalLightenEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/HorizontalLightenEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/Lighten.fx:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marcus Schweda
2 | // This file is licensed under the MIT license (see LICENSE)
3 |
4 | sampler2D input : register(s0);
5 |
6 | float delta : register(c0);
7 |
8 | // RGB -> HSL
9 | float4 hsl(float4 c) {
10 | float4 c2 = c.a;
11 | float M = max(c.r, max(c.g, c.b)),
12 | m = min(c.r, min(c.g, c.b));
13 | float chroma = M - m;
14 | // Lightness
15 | c2[2] = (M + m) / 2;
16 | // Hue
17 | if (chroma != 0) {
18 | if (M == c.r)
19 | c2[0] = ((c.g - c.b) / chroma) % 6;
20 | else if (M == c.g)
21 | c2[0] = (c.b - c.r) / chroma + 2;
22 | else
23 | c2[0] = (c.r - c.g) / chroma + 4;
24 | if (c2[0] < 0)
25 | c2[0] += 6;
26 | // Saturation
27 | c2[1] = chroma / (1 - abs(2 * c2[2] - 1));
28 | }
29 | else {
30 | c2[0] = c2[1] = 0;
31 | }
32 | return c2;
33 | }
34 |
35 | float4 rgb(float4 c) {
36 | float4 c2 = c[3];
37 | float chroma = c[1] * (1 - abs(2 * c[2] - 1));
38 | float X = chroma * (1 - abs(c[0] % 2 - 1));
39 |
40 | if (0 <= c[0] && c[0] < 1)
41 | c2.rgb = float3(chroma, X, 0);
42 | else if (1 <= c[0] && c[0] < 2)
43 | c2.rgb = float3(X, chroma, 0);
44 | else if (2 <= c[0] && c[0] < 3)
45 | c2.rgb = float3(0, chroma, X);
46 | else if (3 <= c[0] && c[0] < 4)
47 | c2.rgb = float3(0, X, chroma);
48 | else if (4 <= c[0] && c[0] < 5)
49 | c2.rgb = float3(X, 0, chroma);
50 | else if (5 <= c[0] && c[0] < 6)
51 | c2.rgb = float3(chroma, 0, X);
52 |
53 | c2.rgb += c[2] - chroma / 2;
54 | return c2;
55 | }
56 |
57 | float4 main(float2 uv : TEXCOORD) : COLOR{
58 | float4 hcyin = hsl(tex2D(input, uv));
59 | if (delta > 0)
60 | {
61 | hcyin[2] = saturate(hcyin[2] + (1 - hcyin[2]) * delta);
62 | }
63 | else
64 | {
65 | hcyin[2] = saturate(hcyin[2] + hcyin[2] * delta);
66 | }
67 |
68 | return rgb(hcyin);
69 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/LightenEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/LightenEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/LongShadow.fx:
--------------------------------------------------------------------------------
1 | sampler2D input : register(s0);
2 |
3 | /// ShadowLength.
4 | /// 0
5 | /// 255
6 | /// 100
7 | float ShadowLength : register(C0);
8 |
9 | /// Opacity.
10 | /// 0
11 | /// 1
12 | /// 1
13 | float Opacity : register(C1);
14 |
15 | /// Opacity.
16 | /// 0
17 | /// 800
18 | /// 800
19 | float Width : register(C2);
20 |
21 | /// Opacity.
22 | /// 0
23 | /// 600
24 | /// 600
25 | float Height : register(C3);
26 |
27 | /// Color.
28 | /// Black
29 | float4 Color : register(C4);
30 |
31 | float4 main(float2 uv : TEXCOORD) : COLOR
32 | {
33 | float4 srcColor = tex2D(input, uv);
34 | if (srcColor.a == 1)
35 | {
36 | return srcColor;
37 | }
38 |
39 | float4 tempColor = 0;
40 | float2 offset = 0;
41 | int maxDepth = 400;
42 | //maxDepth=min(maxDepth, ShadowLength);
43 | float a = 0;
44 | for (float i = 1; i < maxDepth; i++)
45 | {
46 | if (i < ShadowLength)
47 | {
48 | if (a == 0)
49 | {
50 | offset = uv.xy - float2(i / Width, i / Height);
51 | if (offset.x > 0 && offset.y > 0)
52 | {
53 | tempColor = tex2D(input, offset);
54 | if (tempColor.a == 1)
55 | {
56 | a = (1 - i / max(1,ShadowLength));
57 | }
58 | }
59 | }
60 | }
61 | }
62 |
63 | if (a == 0)
64 | {
65 | return srcColor;
66 | }
67 |
68 | a = min(1,a);
69 | tempColor.rgb = Color.rgb * a * Opacity;
70 | tempColor.a = a * Opacity;
71 | float4 outColor = (1 - srcColor.a) * tempColor + srcColor;
72 | return outColor;
73 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/LongShadowEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/LongShadowEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/OpacityThreshold.fx:
--------------------------------------------------------------------------------
1 | sampler2D input : register(s0);
2 |
3 | // new HLSL shader
4 | // modify the comment parameters to reflect your shader parameters
5 |
6 | /// Explain the purpose of this variable.
7 | /// 0/minValue>
8 | /// 1
9 | /// 0.5
10 | float Thresh : register(C0);
11 |
12 | float4 main(float2 uv : TEXCOORD) : COLOR
13 | {
14 | float4 color;
15 | color = tex2D(input, uv.xy);
16 | if (color.a == 0 || color.a == 1 || Thresh == 0)
17 | {
18 | return color;
19 | }
20 | float4 resultColor = 0;
21 | float opacity = color.a > Thresh ? 1 : 0;
22 | if (opacity > 0)
23 | {
24 | resultColor.rgb = color.rgb / color.a * opacity;
25 | }
26 |
27 | resultColor.a = opacity;
28 | return resultColor;
29 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/OpacityThresholdEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/OpacityThresholdEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/SmoothOpacityThreshold.fx:
--------------------------------------------------------------------------------
1 | sampler2D input : register(s0);
2 |
3 | // new HLSL shader
4 | // modify the comment parameters to reflect your shader parameters
5 |
6 | /// Explain the purpose of this variable.
7 | /// 0/minValue>
8 | /// 1
9 | /// 0.52
10 | float UpperThresh : register(C0);
11 |
12 | /// Explain the purpose of this variable.
13 | /// 0/minValue>
14 | /// 1
15 | /// 0.5
16 | float LowerThresh : register(C1);
17 |
18 | float4 main(float2 uv : TEXCOORD) : COLOR
19 | {
20 | float4 color;
21 | color = tex2D(input, uv.xy);
22 | if (color.a == 0 || color.a == 1 || LowerThresh == 0)
23 | {
24 | return color;
25 | }
26 |
27 | if (UpperThresh < LowerThresh)
28 | {
29 | return color;
30 | }
31 |
32 | float4 resultColor = 0;
33 | float opacity = 1;
34 | if (color.a < LowerThresh)
35 | {
36 | opacity = 0;
37 | }
38 | if (color.a > LowerThresh && color.a < UpperThresh)
39 | {
40 | opacity = (color.a - LowerThresh) / (UpperThresh - LowerThresh);
41 | }
42 |
43 | if (opacity > 0)
44 | {
45 | resultColor.rgb = color.rgb / color.a * opacity;
46 | }
47 |
48 | resultColor.a = opacity;
49 | return resultColor;
50 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/Shaders/SmoothOpacityThresholdEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab.Effects/Shaders/SmoothOpacityThresholdEffect.ps
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/SmoothOpacityThresholdEffect.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // ?????????
4 | // ?????:4.0.30319.42000
5 | //
6 | // ???????????????????????
7 | // ????????????????
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Windows;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Effects;
15 | using System.Windows.Media.Media3D;
16 |
17 |
18 | namespace WpfDesignAndAnimationLab.Effects {
19 |
20 | public class SmoothOpacityThresholdEffect : ShaderEffect {
21 | public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(SmoothOpacityThresholdEffect), 0);
22 | public static readonly DependencyProperty UpperThreshProperty = DependencyProperty.Register("UpperThresh", typeof(double), typeof(SmoothOpacityThresholdEffect), new UIPropertyMetadata(((double)(0.52D)), PixelShaderConstantCallback(0)));
23 | public static readonly DependencyProperty LowerThreshProperty = DependencyProperty.Register("LowerThresh", typeof(double), typeof(SmoothOpacityThresholdEffect), new UIPropertyMetadata(((double)(0.5D)), PixelShaderConstantCallback(1)));
24 | public SmoothOpacityThresholdEffect() {
25 | PixelShader pixelShader = new PixelShader();
26 | pixelShader.UriSource = new Uri("/WpfDesignAndAnimationLab.Effects;component/Shaders/SmoothOpacityThresholdEffect.ps", UriKind.Relative);
27 | this.PixelShader = pixelShader;
28 |
29 | this.UpdateShaderValue(InputProperty);
30 | this.UpdateShaderValue(UpperThreshProperty);
31 | this.UpdateShaderValue(LowerThreshProperty);
32 | }
33 | public Brush Input {
34 | get {
35 | return ((Brush)(this.GetValue(InputProperty)));
36 | }
37 | set {
38 | this.SetValue(InputProperty, value);
39 | }
40 | }
41 | public double UpperThresh {
42 | get {
43 | return ((double)(this.GetValue(UpperThreshProperty)));
44 | }
45 | set {
46 | this.SetValue(UpperThreshProperty, value);
47 | }
48 | }
49 | public double LowerThresh {
50 | get {
51 | return ((double)(this.GetValue(LowerThreshProperty)));
52 | }
53 | set {
54 | this.SetValue(LowerThreshProperty, value);
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.Effects/WpfDesignAndAnimationLab.Effects.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0-windows
5 | enable
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | Never
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfDesignAndAnimationLab", "WpfDesignAndAnimationLab\WpfDesignAndAnimationLab.csproj", "{1AB1734B-B510-4195-A30F-8925256F9BC1}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfDesignAndAnimationLab.Effects", "WpfDesignAndAnimationLab.Effects\WpfDesignAndAnimationLab.Effects.csproj", "{BAECDCF7-8906-4224-9537-35A381005AF3}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {1AB1734B-B510-4195-A30F-8925256F9BC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {1AB1734B-B510-4195-A30F-8925256F9BC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {1AB1734B-B510-4195-A30F-8925256F9BC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {1AB1734B-B510-4195-A30F-8925256F9BC1}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {BAECDCF7-8906-4224-9537-35A381005AF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {BAECDCF7-8906-4224-9537-35A381005AF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {BAECDCF7-8906-4224-9537-35A381005AF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {BAECDCF7-8906-4224-9537-35A381005AF3}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {72A484D5-AA7D-452A-9F58-FC2500960B9D}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 4.0
20 | 8
21 | #fbfffe
22 | #dce1f4
23 | #2fcfe9
24 | #9296af
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfDesignAndAnimationLab
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/Images/BingWallpaper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/Images/BingWallpaper.jpg
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/Images/hero_iphone_14_pro.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/Images/hero_iphone_14_pro.jpg
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/Images/windows.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/Images/windows.jpg
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/OstrichSans-Light.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/OstrichSans-Light.otf
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/VGAFIX.FON:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/VGAFIX.FON
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/fixedsys.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/fixedsys.ttf
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Assets/hooge-0857.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Assets/hooge-0857.ttf
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Behaviors/ChangeAngleToEnterPointerBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 | using System.Windows.Shapes;
6 | using Microsoft.Xaml.Behaviors;
7 |
8 | namespace WpfDesignAndAnimationLab.Behaviors
9 | {
10 | public class ChangeAngleToEnterPointerBehavior : Behavior
11 | {
12 | protected override void OnAttached()
13 | {
14 | base.OnAttached();
15 | AssociatedObject.MouseEnter += AssociatedObject_MouseEnter;
16 | AssociatedObject.MouseLeave += AssociatedObject_MouseLeave;
17 | }
18 |
19 | private void AssociatedObject_MouseEnter(object sender, MouseEventArgs e) => UpdateAngle(e);
20 |
21 | private void AssociatedObject_MouseLeave(object sender, MouseEventArgs e) => UpdateAngle(e);
22 |
23 | private void UpdateAngle(MouseEventArgs e)
24 | {
25 | if (AssociatedObject == null || AssociatedObject.StrokeThickness == 0)
26 | {
27 | return;
28 | }
29 |
30 | AssociatedObject.RenderTransformOrigin = new Point(0.5, 0.5);
31 | if (AssociatedObject.RenderTransform is not RotateTransform rotateTransform)
32 | {
33 | rotateTransform = new RotateTransform();
34 | AssociatedObject.RenderTransform = rotateTransform;
35 | }
36 |
37 | var point = e.GetPosition(AssociatedObject.Parent as UIElement);
38 | var centerPoint = new Point(AssociatedObject.ActualWidth / 2, AssociatedObject.ActualHeight / 2);
39 | var angleOfLine = Math.Atan2(point.Y - centerPoint.Y, point.X - centerPoint.X) * 180 / Math.PI;
40 | rotateTransform.Angle = angleOfLine + 180;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Behaviors/ProgressToEllipseBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Windows.Shapes;
5 | using Microsoft.Xaml.Behaviors;
6 |
7 | namespace WpfDesignAndAnimationLab.Behaviors
8 | {
9 | public class ProgressToEllipseBehavior : Behavior
10 | {
11 | ///
12 | /// 标识 Progress 依赖属性。
13 | ///
14 | public static readonly DependencyProperty ProgressProperty =
15 | DependencyProperty.Register("Progress", typeof(double), typeof(ProgressToEllipseBehavior),
16 | new PropertyMetadata(0d, OnProgressChanged));
17 |
18 | ///
19 | /// 获取或设置Progress的值
20 | ///
21 | public double Progress
22 | {
23 | get => (double)GetValue(ProgressProperty);
24 | set => SetValue(ProgressProperty, value);
25 | }
26 |
27 | protected virtual double GetTotalLength()
28 | {
29 | if (AssociatedObject == null)
30 | {
31 | return 0;
32 | }
33 |
34 | return (AssociatedObject.ActualHeight - AssociatedObject.StrokeThickness) * Math.PI;
35 | }
36 |
37 | protected override void OnAttached()
38 | {
39 | base.OnAttached();
40 | UpdateStrokeDashArray();
41 | }
42 |
43 | protected virtual void OnProgressChanged(double oldValue, double newValue) => UpdateStrokeDashArray();
44 |
45 | private static void OnProgressChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
46 | {
47 | var target = obj as ProgressToEllipseBehavior;
48 | var oldValue = (double)args.OldValue;
49 | var newValue = (double)args.NewValue;
50 | if (oldValue != newValue)
51 | {
52 | target.OnProgressChanged(oldValue, newValue);
53 | }
54 | }
55 |
56 | private void UpdateStrokeDashArray()
57 | {
58 | if (AssociatedObject == null || AssociatedObject.StrokeThickness == 0)
59 | {
60 | return;
61 | }
62 |
63 | //if (target.ActualHeight == 0 || target.ActualWidth == 0)
64 | // return;
65 |
66 | var totalLength = GetTotalLength();
67 | totalLength /= AssociatedObject.StrokeThickness;
68 | var thirdSection = Progress * totalLength / 100;
69 | var secondSection = (totalLength - thirdSection) / 2;
70 | var result = new DoubleCollection { 0, secondSection, thirdSection, double.MaxValue };
71 | AssociatedObject.StrokeDashArray = result;
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/DoubleIncreaser.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public class DoubleIncreaser : Increaser
6 | {
7 | public static readonly DependencyProperty StartProperty =
8 | DependencyProperty.Register("Start", typeof(double), typeof(DoubleIncreaser),
9 | new PropertyMetadata(default(double)));
10 |
11 | private double _current;
12 |
13 | public override double Next
14 | {
15 | get
16 | {
17 | var result = Start + _current;
18 | _current += Step;
19 | return result;
20 | }
21 | }
22 |
23 | public override double Start
24 | {
25 | get => (double)GetValue(StartProperty);
26 | set => SetValue(StartProperty, value);
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/DoubleWrapper.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public class DoubleWrapper : ValueWrapper
6 | {
7 | public static readonly DependencyProperty ValueProperty =
8 | DependencyProperty.Register("Value", typeof(double), typeof(DoubleWrapper),
9 | new PropertyMetadata(default(double)));
10 |
11 | public override double Value
12 | {
13 | get => (double)GetValue(ValueProperty);
14 | set => SetValue(ValueProperty, value);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/DurationIncreaser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | namespace WpfDesignAndAnimationLab.Common
5 | {
6 | public class DurationIncreaser : Increaser
7 | {
8 | public static readonly DependencyProperty StartProperty =
9 | DependencyProperty.Register("Start", typeof(Duration), typeof(DurationIncreaser),
10 | new PropertyMetadata(new Duration(TimeSpan.Zero)));
11 |
12 | private Duration _current = new(TimeSpan.Zero);
13 |
14 | public override Duration Next
15 | {
16 | get
17 | {
18 | var result = Start + _current;
19 | _current += Step;
20 | return result;
21 | }
22 | }
23 |
24 | public override Duration Start
25 | {
26 | get => (Duration)GetValue(StartProperty);
27 | set => SetValue(StartProperty, value);
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/HslColor.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the LICENSE file in the project root for more information.
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace WpfDesignAndAnimationLab.Common
12 | {
13 | ///
14 | /// Defines a color in Hue/Saturation/Lightness (HSL) space.
15 | ///
16 | public struct HslColor
17 | {
18 | ///
19 | /// The Hue in 0..360 range.
20 | ///
21 | public double H;
22 |
23 | ///
24 | /// The Saturation in 0..1 range.
25 | ///
26 | public double S;
27 |
28 | ///
29 | /// The Lightness in 0..1 range.
30 | ///
31 | public double L;
32 |
33 | ///
34 | /// The Alpha/opacity in 0..1 range.
35 | ///
36 | public double A;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/HsvColor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WpfDesignAndAnimationLab.Common
8 | {
9 | ///
10 | /// Defines a color in Hue/Saturation/Value (HSV) space.
11 | ///
12 | public struct HsvColor
13 | {
14 | ///
15 | /// The Hue in 0..360 range.
16 | ///
17 | public double H;
18 |
19 | ///
20 | /// The Saturation in 0..1 range.
21 | ///
22 | public double S;
23 |
24 | ///
25 | /// The Value in 0..1 range.
26 | ///
27 | public double V;
28 |
29 | ///
30 | /// The Alpha/opacity in 0..1 range.
31 | ///
32 | public double A;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/Increaser.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public abstract class Increaser : DependencyObject
6 | {
7 | public abstract T Next { get; }
8 | public virtual T Start { get; set; }
9 |
10 | public T Step { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/ProgressWrapper.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public class ProgressWrapper : DependencyObject
6 | {
7 | ///
8 | /// 标识 Progress 依赖属性。
9 | ///
10 | public static readonly DependencyProperty ProgressProperty =
11 | DependencyProperty.Register("Progress", typeof(double), typeof(ProgressWrapper), new PropertyMetadata(0d));
12 |
13 | ///
14 | /// 获取或设置Progress的值
15 | ///
16 | public double Progress
17 | {
18 | get => (double)GetValue(ProgressProperty);
19 | set => SetValue(ProgressProperty, value);
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/RandomColorCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Media;
3 |
4 | namespace WpfDesignAndAnimationLab.Common
5 | {
6 | public class RandomColorCreator : RandomCreator
7 | {
8 | private readonly Random _random;
9 |
10 | public RandomColorCreator()
11 | {
12 | var tick = DateTime.Now.Ticks;
13 | _random = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
14 | }
15 |
16 | public override Color Next =>
17 | Color.FromRgb((byte)_random.Next(255), (byte)_random.Next(255), (byte)_random.Next(255));
18 | }
19 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/RandomCreator.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public abstract class RandomCreator : DependencyObject
6 | {
7 | public T Max { get; set; }
8 |
9 | public abstract T Next { get; }
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/RandomDoubleCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public class RandomDoubleCreator : RandomCreator
6 | {
7 | private readonly Random _random = new();
8 |
9 | public override double Next => _random.NextDouble() * _random.Next(Convert.ToInt32(Math.Round(Max)));
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfDesignAndAnimationLab/Common/RepeatCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace WpfDesignAndAnimationLab.Common
4 | {
5 | public class RepeatCollection : Collection