├── .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 6 | { 7 | private int _offset; 8 | 9 | public object Next 10 | { 11 | get 12 | { 13 | if (Count == 0) 14 | { 15 | return null; 16 | } 17 | 18 | var result = this[_offset]; 19 | _offset++; 20 | if (_offset > Count - 1) 21 | { 22 | _offset = 0; 23 | } 24 | 25 | return result; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Common/TimeSpanIncreaser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace WpfDesignAndAnimationLab.Common 5 | { 6 | public class TimeSpanIncreaser : Increaser 7 | { 8 | public static readonly DependencyProperty StartProperty = 9 | DependencyProperty.Register("Start", typeof(TimeSpan), typeof(TimeSpanIncreaser), 10 | new PropertyMetadata(default(TimeSpan))); 11 | 12 | private TimeSpan _current; 13 | 14 | public override TimeSpan Next 15 | { 16 | get 17 | { 18 | var result = Start + _current; 19 | _current += Step; 20 | return result; 21 | } 22 | } 23 | 24 | public override TimeSpan Start 25 | { 26 | get => (TimeSpan)GetValue(StartProperty); 27 | set => SetValue(StartProperty, value); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Common/TimeSpanWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace WpfDesignAndAnimationLab.Common 5 | { 6 | public class TimeSpanWrapper : ValueWrapper 7 | { 8 | public static readonly DependencyProperty ValueProperty = 9 | DependencyProperty.Register("Value", typeof(TimeSpan), typeof(TimeSpanWrapper), 10 | new PropertyMetadata(default(TimeSpan))); 11 | 12 | public override TimeSpan Value 13 | { 14 | get => (TimeSpan)GetValue(ValueProperty); 15 | set => SetValue(ValueProperty, value); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Common/ValueWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace WpfDesignAndAnimationLab.Common 4 | { 5 | public abstract class ValueWrapper : DependencyObject 6 | { 7 | public abstract T Value { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/ActivationContentControl.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using WpfDesignAndAnimationLab.Common; 4 | 5 | namespace WpfDesignAndAnimationLab.Controls 6 | { 7 | public class ActivationContentControl : ContentControl 8 | { 9 | public ActivationContentControl() 10 | { 11 | this.DefaultStyleKey = typeof(ActivationContentControl); 12 | IsEnabledChanged += ActivationContentControl_IsEnabledChanged; 13 | } 14 | 15 | public override void OnApplyTemplate() 16 | { 17 | base.OnApplyTemplate(); 18 | UpdateVisualStates(false); 19 | } 20 | 21 | private void ActivationContentControl_IsEnabledChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e) 22 | { 23 | UpdateVisualStates(); 24 | } 25 | 26 | private void UpdateVisualStates(bool useTransitions = true) 27 | { 28 | if (this.IsEnabled) 29 | VisualStateManager.GoToState(this, VisualStates.StateNormal, useTransitions); 30 | else 31 | VisualStateManager.GoToState(this, VisualStates.StateDisabled, useTransitions); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/Direction.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Controls 2 | { 3 | public enum Direction 4 | { 5 | Left, 6 | Up, 7 | Right, 8 | Down 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/InnerShadowBox.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Media.Effects; 4 | 5 | namespace WpfDesignAndAnimationLab.Controls 6 | { 7 | public class InnerShadowBox : ContentControl 8 | { 9 | public static readonly DependencyProperty CornerRadiusProperty = 10 | DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(InnerShadowBox), new PropertyMetadata(default(CornerRadius))); 11 | 12 | public static readonly DependencyProperty InnerShadowEffectProperty = 13 | DependencyProperty.Register(nameof(InnerShadowEffect), typeof(DropShadowEffect), typeof(InnerShadowBox), new PropertyMetadata(null)); 14 | 15 | public InnerShadowBox() => DefaultStyleKey = typeof(InnerShadowBox); 16 | 17 | public CornerRadius CornerRadius 18 | { 19 | get => (CornerRadius)GetValue(CornerRadiusProperty); 20 | set => SetValue(CornerRadiusProperty, value); 21 | } 22 | 23 | public DropShadowEffect InnerShadowEffect 24 | { 25 | get => (DropShadowEffect)GetValue(InnerShadowEffectProperty); 26 | set => SetValue(InnerShadowEffectProperty, value); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/NeuomorphismLightSource.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Controls 2 | { 3 | public enum NeuomorphismLightSource 4 | { 5 | TopLeft, 6 | 7 | TopRight, 8 | 9 | BottomLeft, 10 | 11 | BottomRight 12 | } 13 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/NeuomorphismShape.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Controls 2 | { 3 | public enum NeuomorphismShape 4 | { 5 | Flat, 6 | 7 | Concave, 8 | 9 | Convex, 10 | 11 | Pressed 12 | } 13 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/TemplateSettingValues.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace WpfDesignAndAnimationLab.Controls 4 | { 5 | public partial class ProgressRing 6 | { 7 | public class TemplateSettingValues : DependencyObject 8 | { 9 | // Using a DependencyProperty as the backing store for EllipseDiameter. This enables animation, styling, binding, etc... 10 | public static readonly DependencyProperty EllipseDiameterProperty = 11 | DependencyProperty.Register("EllipseDiameter", typeof(double), typeof(TemplateSettingValues), 12 | new PropertyMetadata(0D)); 13 | 14 | // Using a DependencyProperty as the backing store for EllipseOffset. This enables animation, styling, binding, etc... 15 | public static readonly DependencyProperty EllipseOffsetProperty = 16 | DependencyProperty.Register("EllipseOffset", typeof(Thickness), typeof(TemplateSettingValues), 17 | new PropertyMetadata(default(Thickness))); 18 | 19 | // Using a DependencyProperty as the backing store for MaxSideLength. This enables animation, styling, binding, etc... 20 | public static readonly DependencyProperty MaxSideLengthProperty = 21 | DependencyProperty.Register("MaxSideLength", typeof(double), typeof(TemplateSettingValues), 22 | new PropertyMetadata(0D)); 23 | 24 | public TemplateSettingValues(double width) 25 | { 26 | if (width <= 40) 27 | { 28 | EllipseDiameter = width / 10 + 1; 29 | } 30 | else 31 | { 32 | EllipseDiameter = width / 10; 33 | } 34 | 35 | MaxSideLength = width - EllipseDiameter; 36 | EllipseOffset = new Thickness(0, EllipseDiameter * 2.5, 0, 0); 37 | } 38 | 39 | public double EllipseDiameter 40 | { 41 | get => (double)GetValue(EllipseDiameterProperty); 42 | set => SetValue(EllipseDiameterProperty, value); 43 | } 44 | 45 | public Thickness EllipseOffset 46 | { 47 | get => (Thickness)GetValue(EllipseOffsetProperty); 48 | set => SetValue(EllipseOffsetProperty, value); 49 | } 50 | 51 | public double MaxSideLength 52 | { 53 | get => (double)GetValue(MaxSideLengthProperty); 54 | set => SetValue(MaxSideLengthProperty, value); 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Controls/WobbleContentControl.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using WpfDesignAndAnimationLab.Common; 4 | 5 | namespace WpfDesignAndAnimationLab.Controls 6 | { 7 | [TemplateVisualState(Name = VisualStates.StateHidden, GroupName = VisualStates.GroupVisibility)] 8 | [TemplateVisualState(Name = VisualStates.StateHidden, GroupName = VisualStates.GroupVisibility)] 9 | [TemplateVisualState(Name = VisualStates.StateHidden, GroupName = VisualStates.GroupVisibility)] 10 | [TemplateVisualState(Name = VisualStates.StateHidden, GroupName = VisualStates.GroupVisibility)] 11 | public class WobbleContentControl : ContentControl 12 | { 13 | public const string StateCenter = "Center"; 14 | public const string StateDown = "Down"; 15 | public const string StateLeft = "Left"; 16 | public const string StateRight = "Right"; 17 | public const string StateUp = "Up"; 18 | 19 | /// 20 | /// 标识 Direction 依赖属性。 21 | /// 22 | public static readonly DependencyProperty DirectionProperty = 23 | DependencyProperty.Register(nameof(Direction), typeof(Direction), typeof(WobbleContentControl), new PropertyMetadata(Direction.Left)); 24 | 25 | public WobbleContentControl() 26 | { 27 | this.DefaultStyleKey = typeof(WobbleContentControl); 28 | } 29 | 30 | /// 31 | /// 获取或设置Direction的值 32 | /// 33 | public Direction Direction 34 | { 35 | get => (Direction)GetValue(DirectionProperty); 36 | set => SetValue(DirectionProperty, value); 37 | } 38 | 39 | public void Wobble() 40 | { 41 | switch (Direction) 42 | { 43 | case Direction.Left: 44 | Wobble(StateLeft); 45 | break; 46 | 47 | case Direction.Right: 48 | Wobble(StateRight); 49 | break; 50 | 51 | case Direction.Up: 52 | Wobble(StateUp); 53 | break; 54 | 55 | case Direction.Down: 56 | Wobble(StateDown); 57 | break; 58 | 59 | default: break; 60 | } 61 | } 62 | 63 | public void Wobble(string state) 64 | { 65 | VisualStateManager.GoToState(this, StateCenter, false); 66 | VisualStateManager.GoToState(this, state, true); 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Converters/FontWeightConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace WpfDesignAndAnimationLab.Converters 7 | { 8 | public class FontWeightConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => 11 | FontWeight.FromOpenTypeWeight(System.Convert.ToInt32(value)); 12 | 13 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => 14 | throw new NotImplementedException(); 15 | } 16 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Converters/LightenConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows.Media; 5 | using WpfDesignAndAnimationLab.Media; 6 | 7 | namespace WpfDesignAndAnimationLab.Converters 8 | { 9 | public class LightenConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | if (value is not SolidColorBrush brush) 14 | { 15 | return value; 16 | } 17 | 18 | var amount = System.Convert.ToDouble(parameter); 19 | 20 | return new SolidColorBrush(new HslColor(brush.Color).Lighten(amount).ToRgb()); 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => 24 | throw new NotImplementedException(); 25 | } 26 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Converters/ProgressBarWidthConverter.cs: -------------------------------------------------------------------------------- 1 | /************************************************************************************* 2 | 3 | Extended WPF Toolkit 4 | 5 | Copyright (C) 2007-2013 Xceed Software Inc. 6 | 7 | This program is provided to you under the terms of the Microsoft Public 8 | License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 9 | 10 | For more features, controls, and fast professional support, 11 | pick up the Plus Edition at http://xceed.com/wpf_toolkit 12 | 13 | Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids 14 | 15 | ***********************************************************************************/ 16 | 17 | using System; 18 | using System.Globalization; 19 | using System.Windows.Data; 20 | 21 | namespace WpfDesignAndAnimationLab.Converters 22 | { 23 | public class ProgressBarWidthConverter : IMultiValueConverter 24 | { 25 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | var contentWidth = (double)values[0]; 28 | var parentMinWidth = (double)values[1]; 29 | 30 | return Math.Max(contentWidth, parentMinWidth); 31 | } 32 | 33 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => 34 | throw new NotImplementedException(); 35 | } 36 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Converters/ProgressToHeightConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Data; 6 | 7 | namespace WpfDesignAndAnimationLab.Converters 8 | { 9 | public class ProgressToHeightConverter : DependencyObject, IValueConverter 10 | { 11 | /// 12 | /// 标识 TargetContentControl 依赖属性。 13 | /// 14 | public static readonly DependencyProperty TargetContentControlProperty = 15 | DependencyProperty.Register("TargetContentControl", typeof(ContentControl), 16 | typeof(ProgressToHeightConverter), new PropertyMetadata(null)); 17 | 18 | /// 19 | /// 获取或设置TargetContentControl的值 20 | /// 21 | public ContentControl TargetContentControl 22 | { 23 | get => (ContentControl)GetValue(TargetContentControlProperty); 24 | set => SetValue(TargetContentControlProperty, value); 25 | } 26 | 27 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | if (value is double == false) 30 | { 31 | return 0d; 32 | } 33 | 34 | var progress = (double)value; 35 | 36 | if (TargetContentControl == null) 37 | { 38 | return 0d; 39 | } 40 | 41 | if (TargetContentControl.Content is not FrameworkElement element) 42 | { 43 | return 0d; 44 | } 45 | 46 | return element.Height * progress / 100; 47 | } 48 | 49 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => 50 | throw new NotImplementedException(); 51 | } 52 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Converters/RGBToSRGBColorConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | using System.Windows.Media; 9 | 10 | namespace WpfDesignAndAnimationLab.Converters 11 | { 12 | public class RGBToSRGBColorConverter : IValueConverter 13 | { 14 | private Color ConvertToSRGBColor(Color color) 15 | { 16 | var newColor = new Color(); 17 | newColor.ScR = (float)color.R / 255; 18 | newColor.ScG = (float)color.G / 255; 19 | newColor.ScB = (float)color.B / 255; 20 | 21 | return newColor; 22 | } 23 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | if (value is Color color) 26 | return ConvertToSRGBColor(color); 27 | 28 | return value; 29 | } 30 | 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Converters/ReverseProgressToHeightConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Data; 6 | 7 | namespace WpfDesignAndAnimationLab.Converters 8 | { 9 | public class ReverseProgressToHeightConverter : DependencyObject, IValueConverter 10 | { 11 | /// 12 | /// 标识 TargetContentControl 依赖属性。 13 | /// 14 | public static readonly DependencyProperty TargetContentControlProperty = 15 | DependencyProperty.Register("TargetContentControl", typeof(ContentControl), 16 | typeof(ReverseProgressToHeightConverter), new PropertyMetadata(null)); 17 | 18 | /// 19 | /// 获取或设置TargetContentControl的值 20 | /// 21 | public ContentControl TargetContentControl 22 | { 23 | get => (ContentControl)GetValue(TargetContentControlProperty); 24 | set => SetValue(TargetContentControlProperty, value); 25 | } 26 | 27 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | if (value is double == false) 30 | { 31 | return double.NaN; 32 | } 33 | 34 | var progress = (double)value; 35 | 36 | if (TargetContentControl == null) 37 | { 38 | return double.NaN; 39 | } 40 | 41 | if (TargetContentControl.Content is not FrameworkElement element) 42 | { 43 | return double.NaN; 44 | } 45 | 46 | return element.Height * (100 - progress) / 100; 47 | } 48 | 49 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => 50 | throw new NotImplementedException(); 51 | } 52 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Activation/ActivationDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Activation 17 | { 18 | /// 19 | /// Interaction logic for ActivationDemo1.xaml 20 | /// 21 | public partial class ActivationDemo1 22 | { 23 | public ActivationDemo1() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void DisableButton(object sender, RoutedEventArgs e) 29 | { 30 | ButtonElement.IsEnabled = false; 31 | } 32 | 33 | private void EnableButton(object sender, RoutedEventArgs e) 34 | { 35 | ButtonElement.IsEnabled = true; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/AnimateProgressRing/AnimateProgressRing.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls.Primitives; 3 | using System.Windows.Media.Animation; 4 | using WpfDesignAndAnimationLab.Common; 5 | 6 | namespace WpfDesignAndAnimationLab.Demos.AnimateProgressRing 7 | { 8 | public class AnimateProgressRing : RangeBase 9 | { 10 | private Storyboard _progressStoryboard; 11 | private ProgressWrapper _progressWrapper; 12 | 13 | public AnimateProgressRing() => DefaultStyleKey = typeof(AnimateProgressRing); 14 | 15 | public override void OnApplyTemplate() 16 | { 17 | base.OnApplyTemplate(); 18 | var root = GetTemplateChild("Root") as FrameworkElement; 19 | if (root != null) 20 | { 21 | if (root.Resources.Contains("ProgressStoryboard")) 22 | { 23 | _progressStoryboard = root.Resources["ProgressStoryboard"] as Storyboard; 24 | } 25 | 26 | if (root.Resources.Contains("ProgressWrapper")) 27 | { 28 | _progressWrapper = root.Resources["ProgressWrapper"] as ProgressWrapper; 29 | } 30 | } 31 | 32 | UpdateUI(false); 33 | } 34 | 35 | protected override void OnValueChanged(double oldValue, double newValue) 36 | { 37 | base.OnValueChanged(oldValue, newValue); 38 | UpdateUI(); 39 | } 40 | 41 | private void UpdateUI(bool usingStoryboard = true) 42 | { 43 | var progress = (Value - Minimum) / (Maximum - Minimum) * 100; 44 | if (usingStoryboard && _progressStoryboard != null) 45 | { 46 | _progressStoryboard.Stop(); 47 | (_progressStoryboard.Children[0] as DoubleAnimation).To = progress; 48 | _progressStoryboard.Begin(); 49 | } 50 | else if (_progressWrapper != null) 51 | { 52 | _progressWrapper.Progress = progress; 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/AnimateProgressRing/AnimateProgressRing.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 43 | 44 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/AnimateProgressRing/AnimateProgressRingUsingControlTemplate.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.AnimateProgressRing 2 | { 3 | /// 4 | /// AnimateProgressRingUsingControlTemplate.xaml 的交互逻辑 5 | /// 6 | public partial class AnimateProgressRingUsingControlTemplate 7 | { 8 | public AnimateProgressRingUsingControlTemplate() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/AnimateProgressRing/HardCodeAnimateProgressRing.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 19 | 20 | 21 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/AnimateProgressRing/HardCodeAnimateProgressRing.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.AnimateProgressRing 2 | { 3 | /// 4 | /// HardCodeAnimateProgressRing.xaml 的交互逻辑 5 | /// 6 | public partial class HardCodeAnimateProgressRing 7 | { 8 | public HardCodeAnimateProgressRing() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ArcProgresses/ArcProgressAnimationDemo.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ArcProgresses/ArcProgressAnimationDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ArcProgresses 2 | { 3 | /// 4 | /// ArcProgressAnimationDemo.xaml 的交互逻辑 5 | /// 6 | public partial class ArcProgressAnimationDemo 7 | { 8 | public ArcProgressAnimationDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ArcProgresses/ArcProgressDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ArcProgresses 2 | { 3 | /// 4 | /// RadialProgressDemo.xaml 的交互逻辑 5 | /// 6 | public partial class ArcProgressDemo 7 | { 8 | public ArcProgressDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ArcProgresses/ArcProgressDesignDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ArcProgresses 2 | { 3 | /// 4 | /// http://preview.binlive.cn/arc-progress 5 | /// https://codepen.io/nathgreen/pen/gdwZaE 6 | /// 7 | public partial class ArcProgressDesignDemo 8 | { 9 | public ArcProgressDesignDemo() => InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/BorderAnimations/UserControl1.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.BorderAnimations 17 | { 18 | /// 19 | /// UserControl1.xaml 的交互逻辑 20 | /// 21 | public partial class UserControl1 : UserControl 22 | { 23 | public UserControl1() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Buttons/ButtonDesignDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Buttons 2 | { 3 | /// 4 | /// ButtonDesignDemo1.xaml 的交互逻辑 5 | /// 6 | public partial class ButtonDesignDemo1 7 | { 8 | public ButtonDesignDemo1() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Buttons/ButtonDesignDemo2.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Buttons 2 | { 3 | /// 4 | /// ButtonDesignDemo2.xaml 的交互逻辑 5 | /// 6 | public partial class ButtonDesignDemo2 7 | { 8 | public ButtonDesignDemo2() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Buttons/ButtonDesignDemo3.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Buttons 2 | { 3 | /// 4 | /// ButtonDesignDemo2.xaml 的交互逻辑 5 | /// 6 | public partial class ButtonDesignDemo3 7 | { 8 | public ButtonDesignDemo3() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ColorWheel/UserControl1.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ColorWheel/UserControl1.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.ColorWheel 17 | { 18 | /// 19 | /// Interaction logic for UserControl1.xaml 20 | /// 21 | public partial class UserControl1 : UserControl 22 | { 23 | public UserControl1() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ColumnProgressBars/ColumnProgressBarDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ColumnProgressBars 2 | { 3 | /// 4 | /// ColumnProgressBarDemo.xaml 的交互逻辑 5 | /// 6 | public partial class ColumnProgressBarDemo 7 | { 8 | public ColumnProgressBarDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/FakeDropShadowDemo.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | FAKE 38 | SHADOW 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/FakeDropShadowDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Effects 2 | { 3 | /// 4 | /// CustomDropShadowDemo.xaml 的交互逻辑 5 | /// 6 | public partial class FakeDropShadowDemo 7 | { 8 | public FakeDropShadowDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/InnerShadowEffectDemo.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 23 | INNER 24 | SHADOW 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/InnerShadowEffectDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Effects 2 | { 3 | /// 4 | /// InnerShadow.xaml 的交互逻辑 5 | /// 6 | public partial class InnerShadowEffectDemo 7 | { 8 | public InnerShadowEffectDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/LightenDemo.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/LightenDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Effects 2 | { 3 | /// 4 | /// LightenDemo.xaml 的交互逻辑 5 | /// 6 | public partial class LightenDemo 7 | { 8 | public LightenDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/LightenDemoItem.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Effects/LightenDemoItem.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace WpfDesignAndAnimationLab.Demos.Effects 4 | { 5 | /// 6 | /// LightenDemoItem.xaml 的交互逻辑 7 | /// 8 | public partial class LightenDemoItem : UserControl 9 | { 10 | public LightenDemoItem() => InitializeComponent(); 11 | } 12 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/FancyTexts/FancyTextDemoPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 13 | 14 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/FancyTexts/FancyTextDemoPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace WpfDesignAndAnimationLab.Demos.FancyTexts 4 | { 5 | /// 6 | /// FancyTextDemoPage.xaml 的交互逻辑 7 | /// 8 | public partial class FancyTextDemoPage 9 | { 10 | public FancyTextDemoPage() 11 | { 12 | InitializeComponent(); 13 | var backColor = ColorTranslator.FromHtml("#037be2"); 14 | var forColor = ColorTranslator.FromHtml("#ffffff"); 15 | img.Source = FancyText.BitmapImageFromText("测试字体,微软雅黑", 16 | new Font("Microsoft YaHei", 60, System.Drawing.FontStyle.Bold), forColor, backColor, 6); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/GlowEffects/GlowEffectDemo1.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/GlowEffects/GlowEffectDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.GlowEffects 2 | { 3 | /// 4 | /// GlowEffectDemo1.xaml 的交互逻辑 5 | /// 6 | public partial class GlowEffectDemo1 7 | { 8 | public GlowEffectDemo1() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/GlowEffects/GlowLineDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.GlowEffects 2 | { 3 | /// 4 | /// GlowLineDemo.xaml 的交互逻辑 5 | /// 6 | public partial class GlowLineDemo 7 | { 8 | public GlowLineDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/GlowEffects/GlowTextDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.GlowEffects 2 | { 3 | /// 4 | /// GlowLineDemo.xaml 的交互逻辑 5 | /// 6 | public partial class GlowTextDemo 7 | { 8 | public GlowTextDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/GlowEffects/NeonLoveDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace WpfDesignAndAnimationLab.Demos.GlowEffects 4 | { 5 | /// 6 | /// NeonLoveDemo.xaml 的交互逻辑 7 | /// 8 | public partial class NeonLoveDemo : UserControl 9 | { 10 | public NeonLoveDemo() => InitializeComponent(); 11 | } 12 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Gooey/GooeyDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Gooey 17 | { 18 | /// 19 | /// GooeyDemo.xaml 的交互逻辑 20 | /// 21 | public partial class GooeyDemo 22 | { 23 | public GooeyDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Gooey/GooeyEllipseDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Gooey 2 | { 3 | /// 4 | /// GooeyEllipseDemo.xaml 的交互逻辑 5 | /// 6 | public partial class GooeyEllipseDemo 7 | { 8 | public GooeyEllipseDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Gooey/GooeyImageDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Gooey 2 | { 3 | /// 4 | /// GooeyEllipseDemo.xaml 的交互逻辑 5 | /// 6 | public partial class GooeyImageDemo 7 | { 8 | public GooeyImageDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Gooey/GooeyRectangleDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Gooey 2 | { 3 | /// 4 | /// GooeyEllipseDemo.xaml 的交互逻辑 5 | /// 6 | public partial class GooeyRectangleDemo 7 | { 8 | public GooeyRectangleDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Gooey/TextMorph2Demo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Gooey 17 | { 18 | /// 19 | /// TextMorph2Demo.xaml 的交互逻辑 20 | /// 21 | public partial class TextMorph2Demo : UserControl 22 | { 23 | public TextMorph2Demo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Gooey/TextMorphDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace WpfDesignAndAnimationLab.Demos.Gooey 4 | { 5 | /// 6 | /// https://codepen.io/Valgo/pen/PowZaNY 7 | /// 8 | public partial class TextMorphDemo : UserControl 9 | { 10 | public TextMorphDemo() => InitializeComponent(); 11 | } 12 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/InnerShadows/InnerShadowDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.InnerShadows 2 | { 3 | /// 4 | /// InnerShaow1.xaml 的交互逻辑 5 | /// 6 | public partial class InnerShadowDemo 7 | { 8 | public InnerShadowDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/InnerShadows/PathInnerShadowDemo.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 15 | 19 | 20 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/InnerShadows/PathInnerShadowDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.InnerShadows 2 | { 3 | /// 4 | /// PathInnerShadowDemo.xaml 的交互逻辑 5 | /// 6 | public partial class PathInnerShadowDemo 7 | { 8 | public PathInnerShadowDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/InnerShadows/VariableSizeInnerShadowDemo.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 17 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/InnerShadows/VariableSizeInnerShadowDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media.Effects; 3 | 4 | namespace WpfDesignAndAnimationLab.Demos.InnerShadows 5 | { 6 | /// 7 | /// VariableSizeInnerShadowDemo.xaml 的交互逻辑 8 | /// 9 | public partial class VariableSizeInnerShadowDemo 10 | { 11 | public VariableSizeInnerShadowDemo() => InitializeComponent(); 12 | 13 | private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) 14 | { 15 | ShadowElement.Margin = new Thickness(-e.NewValue); 16 | ShadowElement.BorderThickness = new Thickness(e.NewValue); 17 | (ShadowElement.Effect as DropShadowEffect).BlurRadius = e.NewValue * 2; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ItemsControls/IndicatorDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.ItemsControls 17 | { 18 | /// 19 | /// Interaction logic for IndicatorDemo.xaml 20 | /// 21 | public partial class IndicatorDemo 22 | { 23 | public IndicatorDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ItemsControls/RadioButtonsIndicatorDemo.xaml: -------------------------------------------------------------------------------- 1 |  15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ItemsControls/RadioButtonsIndicatorDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.ItemsControls 17 | { 18 | /// 19 | /// Interaction logic for IndicatorDemo.xaml 20 | /// 21 | public partial class RadioButtonsIndicatorDemo 22 | { 23 | public RadioButtonsIndicatorDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo1.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.LongShadows 2 | { 3 | /// 4 | /// LongShadowDemo1.xaml 的交互逻辑 5 | /// 6 | public partial class LongShadowDemo1 7 | { 8 | public LongShadowDemo1() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo2.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo2.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.LongShadows 2 | { 3 | /// 4 | /// LongShadowDemo2.xaml 的交互逻辑 5 | /// 6 | public partial class LongShadowDemo2 7 | { 8 | public LongShadowDemo2() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo3.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 20 | 21 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo3.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.LongShadows 2 | { 3 | /// 4 | /// LongShadowDemo3.xaml 的交互逻辑 5 | /// 6 | public partial class LongShadowDemo3 7 | { 8 | public LongShadowDemo3() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo4.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.LongShadows 2 | { 3 | /// 4 | /// LongShadowDemo4.xaml 的交互逻辑 5 | /// 6 | public partial class LongShadowDemo4 7 | { 8 | public LongShadowDemo4() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo5.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 43 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/LongShadowDemo5.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.LongShadows 2 | { 3 | /// 4 | /// LongShadowDemo4.xaml 的交互逻辑 5 | /// 6 | public partial class LongShadowDemo5 7 | { 8 | public LongShadowDemo5() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/LongShadows/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DinoChan/wpf_design_and_animation_lab/ec0154fdb9f5735e9f6a9528eb9417ab99fbc367/WpfDesignAndAnimationLab/Demos/LongShadows/text.png -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Neuomorphism/NeuomorphismButtonDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Neuomorphism 2 | { 3 | /// 4 | /// NeuomorphismButtonDemo.xaml 的交互逻辑 5 | /// 6 | public partial class NeuomorphismButtonDemo 7 | { 8 | public NeuomorphismButtonDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Neuomorphism/NeuomorphismPanel.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace WpfDesignAndAnimationLab.Demos.Neuomorphism 5 | { 6 | /// 7 | /// https://neumorphism.io/ 8 | /// 9 | public partial class NeuomorphismPanel 10 | { 11 | public NeuomorphismPanel() => InitializeComponent(); 12 | 13 | private void OnSelectedColorChanged(object sender, RoutedPropertyChangedEventArgs e) 14 | { 15 | if (e.NewValue.HasValue) 16 | { 17 | Background = new SolidColorBrush(e.NewValue.Value); 18 | } 19 | } 20 | 21 | private void OnSizeValueChanged(object sender, RoutedPropertyChangedEventArgs e) 22 | { 23 | if (RadiusSlider != null) 24 | { 25 | RadiusSlider.Maximum = e.NewValue / 2; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Neuomorphism/NeuomorphismPanelDemo.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Neuomorphism/NeuomorphismPanelDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Neuomorphism 17 | { 18 | /// 19 | /// NeuomorphismPanelDemo.xaml 的交互逻辑 20 | /// 21 | public partial class NeuomorphismPanelDemo : UserControl 22 | { 23 | public NeuomorphismPanelDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoading.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoading.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.NintendoSwitchLoadings 2 | { 3 | /// 4 | /// NintendoEShopLoading.xaml 的交互逻辑 5 | /// https://codepen.io/jh3y/pen/XYxJBm 6 | /// 7 | public partial class NintendoEShopLoading 8 | { 9 | public NintendoEShopLoading() => InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoadingRow.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoadingRow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Media.Animation; 6 | 7 | namespace WpfDesignAndAnimationLab.Demos.NintendoSwitchLoadings 8 | { 9 | /// 10 | /// NintendoEShopLoadingRow.xaml 的交互逻辑 11 | /// 12 | public partial class NintendoEShopLoadingRow : UserControl 13 | { 14 | // Using a DependencyProperty as the backing store for Delay. This enables animation, styling, binding, etc... 15 | public static readonly DependencyProperty DelayProperty = 16 | DependencyProperty.Register("Delay", typeof(TimeSpan), typeof(NintendoEShopLoadingRow), 17 | new PropertyMetadata(default(TimeSpan))); 18 | 19 | public NintendoEShopLoadingRow() 20 | { 21 | InitializeComponent(); 22 | Loaded += NintendoEShopLoadingRow_Loaded; 23 | } 24 | 25 | public TimeSpan Delay 26 | { 27 | get => (TimeSpan)GetValue(DelayProperty); 28 | set => SetValue(DelayProperty, value); 29 | } 30 | 31 | private async void NintendoEShopLoadingRow_Loaded(object sender, RoutedEventArgs e) 32 | { 33 | await Task.Delay(TimeSpan.FromSeconds(2) + Delay); 34 | (Resources["Storyboard"] as Storyboard).Begin(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoadingRowUsingEffect.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoadingRowUsingEffect.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Media.Animation; 6 | 7 | namespace WpfDesignAndAnimationLab.Demos.NintendoSwitchLoadings 8 | { 9 | /// 10 | /// NintendoEShopLoadingRow.xaml 的交互逻辑 11 | /// 12 | public partial class NintendoEShopLoadingRowUsingEffect : UserControl 13 | { 14 | // Using a DependencyProperty as the backing store for Delay. This enables animation, styling, binding, etc... 15 | public static readonly DependencyProperty DelayProperty = 16 | DependencyProperty.Register("Delay", typeof(TimeSpan), typeof(NintendoEShopLoadingRowUsingEffect), 17 | new PropertyMetadata(default(TimeSpan))); 18 | 19 | public NintendoEShopLoadingRowUsingEffect() 20 | { 21 | InitializeComponent(); 22 | Loaded += NintendoEShopLoadingRow_Loaded; 23 | } 24 | 25 | public TimeSpan Delay 26 | { 27 | get => (TimeSpan)GetValue(DelayProperty); 28 | set => SetValue(DelayProperty, value); 29 | } 30 | 31 | private async void NintendoEShopLoadingRow_Loaded(object sender, RoutedEventArgs e) 32 | { 33 | await Task.Delay(TimeSpan.FromSeconds(2) + Delay); 34 | (Resources["Storyboard"] as Storyboard).Begin(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoadingUsingEffect.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 36 | 38 | 40 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoEShopLoadingUsingEffect.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.NintendoSwitchLoadings 2 | { 3 | /// 4 | /// NintendoEShopLoading.xaml 的交互逻辑 5 | /// https://codepen.io/jh3y/pen/XYxJBm 6 | /// 7 | public partial class NintendoEShopLoadingUsingEffect 8 | { 9 | public NintendoEShopLoadingUsingEffect() => InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/NintendoSwitchLoadings/NintendoSwitchLoading.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.NintendoSwitchLoadings 2 | { 3 | /// 4 | /// NitendoSwitchLoading.xaml 的交互逻辑 5 | /// https://codepen.io/recklessrainb0w/pen/zMeaNE 6 | /// 7 | public partial class NintendoSwitchLoading 8 | { 9 | public NintendoSwitchLoading() => InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/ButtonDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// Demo2Page.xaml 的交互逻辑 5 | /// 6 | public partial class ButtonDemo1 7 | { 8 | public ButtonDemo1() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/ButtonDemo2.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// Demo3Page.xaml 的交互逻辑 5 | /// 6 | public partial class ButtonDemo2 7 | { 8 | public ButtonDemo2() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/ButtonDemo3.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// Demo3Page.xaml 的交互逻辑 5 | /// 6 | public partial class ButtonDemo3 7 | { 8 | public ButtonDemo3() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo1Page.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 5 | { 6 | /// 7 | /// Demo1Page.xaml 的交互逻辑 8 | /// 9 | public partial class Demo1Page 10 | { 11 | public Demo1Page() 12 | { 13 | InitializeComponent(); 14 | Loaded += Demo1Page_Loaded; 15 | } 16 | 17 | public static double GetLength(Geometry geo) 18 | { 19 | var path = geo.GetFlattenedPathGeometry(); 20 | 21 | var length = 0.0; 22 | 23 | foreach (var pf in path.Figures) 24 | { 25 | var start = pf.StartPoint; 26 | 27 | foreach (PolyLineSegment seg in pf.Segments) 28 | { 29 | foreach (var point in seg.Points) 30 | { 31 | length += (start - point).Length; 32 | start = point; 33 | } 34 | } 35 | } 36 | 37 | return length; 38 | } 39 | 40 | private void Demo1Page_Loaded(object sender, RoutedEventArgs e) 41 | { 42 | //var l= GetLength(TextPath.RenderedGeometry); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo5Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// Demo3Page.xaml 的交互逻辑 5 | /// 6 | public partial class Demo5Page 7 | { 8 | public Demo5Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo6Page.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo6Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// Demo3Page.xaml 的交互逻辑 5 | /// 6 | public partial class Demo6Page 7 | { 8 | public Demo6Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo7Page.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 22 | 23 | 28 | 32 | 33 | 34 | 38 | 39 | 40 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo7Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// Demo7Page.xaml 的交互逻辑 5 | /// 6 | public partial class Demo7Page 7 | { 8 | public Demo7Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/Demo8Page.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows; 4 | using System.Windows.Input; 5 | using System.Windows.Media; 6 | 7 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 8 | { 9 | /// 10 | /// Demo7Page.xaml 的交互逻辑 11 | /// 12 | public partial class Demo8Page 13 | { 14 | private readonly Dictionary _items; 15 | private bool _hasPoints; 16 | 17 | public Demo8Page() 18 | { 19 | InitializeComponent(); 20 | _items = new Dictionary(); 21 | SizeChanged += OnPageSizeChanged; 22 | } 23 | 24 | protected override void OnMouseMove(MouseEventArgs e) 25 | { 26 | base.OnMouseMove(e); 27 | if (_hasPoints == false) 28 | { 29 | foreach (var item in _items) 30 | { 31 | var point = item.Key.TransformToVisual(this).Transform(new Point(0, 0)); 32 | point.X += item.Key.ActualWidth / 2; 33 | point.Y += item.Key.ActualHeight / 2; 34 | _items[item.Key] = point; 35 | } 36 | } 37 | 38 | var position = e.GetPosition(this); 39 | 40 | foreach (var item in _items) 41 | { 42 | var subPoint = position - item.Value; 43 | var distance = subPoint.Length; 44 | var sinA = subPoint.Y / distance; 45 | var cosA = subPoint.X / distance; 46 | var tempDistance = distance / 100; 47 | tempDistance = 10 * Math.Min(Math.PI, tempDistance); 48 | var x = cosA * tempDistance; 49 | var y = sinA * tempDistance; 50 | ; 51 | item.Key.RenderTransform = new TranslateTransform(x, y); 52 | } 53 | } 54 | 55 | private void OnItemLoaded(object sender, RoutedEventArgs e) 56 | { 57 | var element = sender as FrameworkElement; 58 | if (_items.ContainsKey(element) == false) 59 | { 60 | _items.Add(element, new Point(0, 0)); 61 | } 62 | } 63 | 64 | private void OnPageSizeChanged(object sender, SizeChangedEventArgs e) => _hasPoints = false; 65 | } 66 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/OutlinedTextButtonDemo.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/OutlinedTextButtonDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 2 | { 3 | /// 4 | /// OutlinedTextButtonDemo.xaml 的交互逻辑 5 | /// 6 | public partial class OutlinedTextButtonDemo 7 | { 8 | public OutlinedTextButtonDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/OutlinedTextControl.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Media; 4 | 5 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 6 | { 7 | public class OutlinedTextControl : Control 8 | { 9 | /// 10 | /// 标识 Stroke 依赖属性。 11 | /// 12 | public static readonly DependencyProperty StrokeProperty = 13 | DependencyProperty.Register(nameof(Stroke), typeof(Brush), typeof(OutlinedTextControl), 14 | new FrameworkPropertyMetadata( 15 | Brushes.Black, 16 | FrameworkPropertyMetadataOptions.AffectsRender)); 17 | 18 | /// 19 | /// 标识 StrokeThickness 依赖属性。 20 | /// 21 | public static readonly DependencyProperty StrokeThicknessProperty = 22 | DependencyProperty.Register(nameof(StrokeThickness), typeof(double), typeof(OutlinedTextControl), 23 | new FrameworkPropertyMetadata( 24 | default(double), 25 | FrameworkPropertyMetadataOptions.AffectsRender)); 26 | 27 | /// 28 | /// 标识 Text 依赖属性。 29 | /// 30 | public static readonly DependencyProperty TextProperty = 31 | DependencyProperty.Register(nameof(Text), typeof(string), typeof(OutlinedTextControl), 32 | new FrameworkPropertyMetadata( 33 | string.Empty, 34 | FrameworkPropertyMetadataOptions.AffectsRender)); 35 | 36 | public OutlinedTextControl() => DefaultStyleKey = typeof(OutlinedTextControl); 37 | 38 | /// 39 | /// 获取或设置Stroke的值 40 | /// 41 | public Brush Stroke 42 | { 43 | get => (Brush)GetValue(StrokeProperty); 44 | set => SetValue(StrokeProperty, value); 45 | } 46 | 47 | /// 48 | /// 49 | /// StrokeThickness 50 | /// 51 | public double StrokeThickness 52 | { 53 | get => (double)GetValue(StrokeThicknessProperty); 54 | set => SetValue(StrokeThicknessProperty, value); 55 | } 56 | 57 | /// 58 | /// 获取或设置Text的值 59 | /// 60 | public string Text 61 | { 62 | get => (string)GetValue(TextProperty); 63 | set => SetValue(TextProperty, value); 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/OutlinedTextControl.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/OutlinedTextDemoPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/OutlinedText/OutlinedTextDemoPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.OutlinedText 17 | { 18 | /// 19 | /// DemoPage.xaml 的交互逻辑 20 | /// 21 | public partial class OutlinedTextDemoPage : UserControl 22 | { 23 | public OutlinedTextDemoPage() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ProgressAndLoading/ProgressDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ProgressAndLoading 2 | { 3 | /// 4 | /// Interaction logic for ProgressDemo1.xaml 5 | /// 6 | public partial class ProgressDemo1 7 | { 8 | public ProgressDemo1() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ProgressRings/LinearGradientCircleLoading.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ProgressRings 2 | { 3 | /// 4 | /// https://csscoco.com/inspiration/#/./background/bg-conic-circle-loading.md 5 | /// 6 | public partial class LinearGradientCircleLoading 7 | { 8 | public LinearGradientCircleLoading() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ProgressRings/LinearGradientFullCircleLoading.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ProgressRings 2 | { 3 | /// 4 | /// https://csscoco.com/inspiration/#/./background/bg-conic-circle-loading.md 5 | /// 6 | public partial class LinearGradientFullCircleLoading 7 | { 8 | public LinearGradientFullCircleLoading() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ProgressRings/ProgressRingBasicDemo.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ProgressRings/ProgressRingBasicDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ProgressRings 2 | { 3 | /// 4 | /// ProgressRingBasicDemo.xaml 的交互逻辑 5 | /// 6 | public partial class ProgressRingBasicDemo 7 | { 8 | public ProgressRingBasicDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/RainbowButtons/RainbowAppleButton.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.RainbowButtons 2 | { 3 | /// 4 | /// RainbowAppleButton.xaml 的交互逻辑 5 | /// 6 | public partial class RainbowAppleButton 7 | { 8 | public RainbowAppleButton() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/RainbowButtons/RainbowAppleButtonWithGlow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.RainbowButtons 2 | { 3 | /// 4 | /// RainbowAppleButtonWithGlow.xaml 的交互逻辑 5 | /// 6 | public partial class RainbowAppleButtonWithGlow 7 | { 8 | public RainbowAppleButtonWithGlow() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/RainbowTexts/RainbowTextDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.RainbowTexts 2 | { 3 | /// 4 | /// RainbowTextDemo1.xaml 的交互逻辑 5 | /// 6 | public partial class RainbowTextDemo1 7 | { 8 | public RainbowTextDemo1() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/RainbowTexts/RainbowTextWithAnimation.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.RainbowTexts 2 | { 3 | /// 4 | /// RainbowTextWithAnimation.xaml 的交互逻辑 5 | /// 6 | public partial class RainbowTextWithAnimation 7 | { 8 | public RainbowTextWithAnimation() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/RainbowTexts/RainbowTextWithRandom.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.RainbowTexts 2 | { 3 | /// 4 | /// RainbowTextWithRandom.xaml 的交互逻辑 5 | /// 6 | public partial class RainbowTextWithRandom 7 | { 8 | public RainbowTextWithRandom() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/RainbowTexts/RainbowTextWithWave.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.RainbowTexts 2 | { 3 | /// 4 | /// RainbowTextWithWave.xaml 的交互逻辑 5 | /// 6 | public partial class RainbowTextWithWave 7 | { 8 | public RainbowTextWithWave() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ScaleMarks/DenseDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ScaleMarks 2 | { 3 | /// 4 | /// DenseDemo.xaml 的交互逻辑 5 | /// 6 | public partial class DenseDemo 7 | { 8 | public DenseDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ScaleMarks/ScaleMarkDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ScaleMarks 2 | { 3 | /// 4 | /// https://codepen.io/icebob/pen/mdERrdg 5 | /// 6 | public partial class ScaleMarkDemo 7 | { 8 | public ScaleMarkDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ScaleMarks/ScaleMarkDemoUsingArcPanel.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ScaleMarks 2 | { 3 | /// 4 | /// ScaleMarkDemoUsingArcPanel.xaml 的交互逻辑 5 | /// 6 | public partial class ScaleMarkDemoUsingArcPanel 7 | { 8 | public ScaleMarkDemoUsingArcPanel() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ScaleMarks/ScaleMarkDemoUsingEllipse.xaml: -------------------------------------------------------------------------------- 1 |  10 | 13 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/ScaleMarks/ScaleMarkDemoUsingEllipse.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.ScaleMarks 2 | { 3 | /// 4 | /// ScaleMarkDemoUsingEllipse.xaml 的交互逻辑 5 | /// 6 | public partial class ScaleMarkDemoUsingEllipse 7 | { 8 | public ScaleMarkDemoUsingEllipse() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shadows/DropShadowColorDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Shadows 17 | { 18 | /// 19 | /// Interaction logic for DropShadowColorDemo.xaml 20 | /// 21 | public partial class DropShadowColorDemo 22 | { 23 | public DropShadowColorDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shadows/DropShadowDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Shadows 17 | { 18 | /// 19 | /// DropShadowDemo.xaml 的交互逻辑 20 | /// 21 | public partial class DropShadowDemo 22 | { 23 | public DropShadowDemo() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void OnSelectedColorChanged(object sender, RoutedPropertyChangedEventArgs e) 29 | { 30 | 31 | } 32 | 33 | private void OnSizeValueChanged(object sender, RoutedPropertyChangedEventArgs e) 34 | { 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/EllipseButtonDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Shapes 2 | { 3 | /// 4 | /// EllipseButtonDemo.xaml 的交互逻辑 5 | /// 6 | public partial class EllipseButtonDemo 7 | { 8 | public EllipseButtonDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/PointsAnimation.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Shapes 2 | { 3 | /// 4 | /// PointsAnimation.xaml 的交互逻辑 5 | /// 6 | public partial class PointsAnimation 7 | { 8 | public PointsAnimation() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/TriangleLoading.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/TriangleLoading.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Shapes 2 | { 3 | /// 4 | /// TriangleLoading.xaml 的交互逻辑 5 | /// 6 | public partial class TriangleLoading 7 | { 8 | public TriangleLoading() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/TriangleLoading2.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 36 | 41 | 42 | 44 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/TriangleLoading2.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Shapes 2 | { 3 | /// 4 | /// TriangleLoading2.xaml 的交互逻辑 5 | /// 6 | public partial class TriangleLoading2 7 | { 8 | public TriangleLoading2() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Shapes/TriangleLoading3.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Shapes 2 | { 3 | /// 4 | /// TriangleLoading3.xaml 的交互逻辑 5 | /// 6 | public partial class TriangleLoading3 7 | { 8 | public TriangleLoading3() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextAndShadows/ChildrenAnimationHelper.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextAndShadows 2 | { 3 | internal class ChildrenAnimationHelper 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextAndShadows/TextAndShadowDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextAndShadows 2 | { 3 | /// 4 | /// TextAndShadowDemo1.xaml 的交互逻辑 5 | /// 6 | public partial class TextAndShadowDemo1 7 | { 8 | public TextAndShadowDemo1() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextAndShadows/TextAndShadowDemo2.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextAndShadows 2 | { 3 | /// 4 | /// TextAndShadowDemo2.xaml 的交互逻辑 5 | /// 6 | public partial class TextAndShadowDemo2 7 | { 8 | public TextAndShadowDemo2() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextAnimations/iPhone14ProTextAnimation.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.TextAnimations 17 | { 18 | /// 19 | /// https://www.cnblogs.com/coco1s/p/16808899.html 20 | /// 21 | public partial class iPhone14ProTextAnimation 22 | { 23 | public iPhone14ProTextAnimation() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void OnScrollChanged(object sender, ScrollChangedEventArgs e) 29 | { 30 | MaskElement.Visibility = e.VerticalOffset > 810? Visibility.Visible: Visibility.Collapsed; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextEffects/TextEffectsBasicDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextEffects 2 | { 3 | /// 4 | /// TextEffectsBasicDemo.xaml 的交互逻辑 5 | /// https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.media.texteffect?view=netframework-4.8 6 | /// 7 | public partial class TextEffectsBasicDemo 8 | { 9 | public TextEffectsBasicDemo() => InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/TextShapeDemo1Page.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 5 | { 6 | /// 7 | /// Demo1Page.xaml 的交互逻辑 8 | /// 9 | public partial class TextShapeDemo1Page 10 | { 11 | public TextShapeDemo1Page() 12 | { 13 | InitializeComponent(); 14 | Loaded += Demo1Page_Loaded; 15 | } 16 | 17 | public static double GetLength(Geometry geo) 18 | { 19 | var path = geo.GetFlattenedPathGeometry(); 20 | 21 | var length = 0.0; 22 | 23 | foreach (var pf in path.Figures) 24 | { 25 | var start = pf.StartPoint; 26 | 27 | foreach (PolyLineSegment seg in pf.Segments) 28 | { 29 | foreach (var point in seg.Points) 30 | { 31 | length += (start - point).Length; 32 | start = point; 33 | } 34 | } 35 | } 36 | 37 | return length; 38 | } 39 | 40 | private void Demo1Page_Loaded(object sender, RoutedEventArgs e) => GetLength(TextPath.RenderedGeometry); 41 | } 42 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/TextShapeDemo2Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// Demo1Page.xaml 的交互逻辑 5 | /// 6 | public partial class TextShapeDemo2Page 7 | { 8 | public TextShapeDemo2Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/TextShapeDemo3Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// Demo9Page.xaml 的交互逻辑 5 | /// 6 | public partial class TextShapeDemo3Page 7 | { 8 | public TextShapeDemo3Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/VariableFont1Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// Demo9Page.xaml 的交互逻辑 5 | /// 6 | public partial class VariableFont1Page 7 | { 8 | public VariableFont1Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/VariableFont2Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// TextShapeDemo5Page.xaml 的交互逻辑 5 | /// 6 | public partial class VariableFont2Page 7 | { 8 | public VariableFont2Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/VariableFont3Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// TextShapeDemo5Page.xaml 的交互逻辑 5 | /// 6 | public partial class VariableFont3Page 7 | { 8 | public VariableFont3Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/VariableFont4Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// TextShapeDemo5Page.xaml 的交互逻辑 5 | /// 6 | public partial class VariableFont4Page 7 | { 8 | public VariableFont4Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/VariableFont5Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// https://codepen.io/garrettbear/pen/YzXaJNO 5 | /// 6 | public partial class VariableFont5Page 7 | { 8 | public VariableFont5Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShapes/VariableFont6Page.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.TextShapes 2 | { 3 | /// 4 | /// https://codepen.io/garrettbear/pen/YzXaJNO 5 | /// 6 | public partial class VariableFont6Page 7 | { 8 | public VariableFont6Page() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/TextShimmers/TextShimmerUsingOpacityMask.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace WpfDesignAndAnimationLab.Demos.TextShimmers 5 | { 6 | /// 7 | /// TextShimmerUsingOpacityMask.xaml 的交互逻辑 8 | /// 9 | public partial class TextShimmerUsingOpacityMask 10 | { 11 | public TextShimmerUsingOpacityMask() 12 | { 13 | InitializeComponent(); 14 | Loaded += OnLoaded; 15 | TextBlock.SizeChanged += TextBlock_SizeChanged; 16 | } 17 | 18 | private void OnLoaded(object sender, RoutedEventArgs e) 19 | { 20 | //var brush = new RadialGradientBrush 21 | //{ 22 | // RadiusX = TextBlock.ActualHeight * 2.2, 23 | // RadiusY = TextBlock.ActualHeight * 2.2, 24 | // MappingMode = BrushMappingMode.Absolute 25 | //}; 26 | 27 | //brush.GradientStops.Add(new GradientStop(Colors.Black, 0)); 28 | //brush.GradientStops.Add(new GradientStop(Color.FromArgb(100, 0, 0, 0), .5)); 29 | //brush.GradientStops.Add(new GradientStop(Color.FromArgb(34, 0, 0, 0), 1)); 30 | 31 | //var centerH = TextBlock.ActualHeight / 2; 32 | //var width = TextBlock.ActualWidth; 33 | //TextBlock.OpacityMask = brush; 34 | 35 | //var storyboard = new Storyboard(); 36 | //var centerAnimation = new PointAnimation 37 | //{ 38 | // From = new Point(-width, centerH), 39 | // To = new Point(width * 2, centerH), 40 | // Duration = TimeSpan.FromSeconds(3.3), 41 | // RepeatBehavior = RepeatBehavior.Forever 42 | //}; 43 | 44 | //Storyboard.SetTarget(centerAnimation, brush); 45 | //Storyboard.SetTargetProperty(centerAnimation, new PropertyPath(RadialGradientBrush.CenterProperty)); 46 | 47 | //var gradientOriginAnimation = new PointAnimation 48 | //{ 49 | // From = new Point(-width, centerH), 50 | // To = new Point(width * 2, centerH), 51 | // Duration = TimeSpan.FromSeconds(3.3), 52 | // RepeatBehavior= RepeatBehavior.Forever 53 | //}; 54 | 55 | //Storyboard.SetTarget(gradientOriginAnimation, brush); 56 | //Storyboard.SetTargetProperty(gradientOriginAnimation, new PropertyPath(RadialGradientBrush.GradientOriginProperty)); 57 | 58 | //storyboard.Children.Add(centerAnimation); 59 | //storyboard.Children.Add(gradientOriginAnimation); 60 | //storyboard.Begin(); 61 | } 62 | 63 | private void TextBlock_SizeChanged(object sender, SizeChangedEventArgs e) 64 | { 65 | var brush = TextBlock.OpacityMask as RadialGradientBrush; 66 | brush.RadiusX = 2 * e.NewSize.Height / e.NewSize.Width; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Transitions/RippleBasic.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Transitions 2 | { 3 | /// 4 | /// RappleBasic.xaml 的交互逻辑 5 | /// 6 | public partial class RippleBasic 7 | { 8 | public RippleBasic() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Transitions/TransitionBusyIndicatorDemo.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Transitions 2 | { 3 | /// 4 | /// TransitionBusyIndicatorDemo.xaml 的交互逻辑 5 | /// 6 | public partial class TransitionBusyIndicatorDemo 7 | { 8 | public TransitionBusyIndicatorDemo() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/WaveProgressBars/HardCodeWaveProgressBar.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 28 | 29 | 32 | 33 | 37 | 38 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/WaveProgressBars/HardCodeWaveProgressBar.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.WaveProgressBars 2 | { 3 | /// 4 | /// HardCodeWaveProgressBar.xaml 的交互逻辑 5 | /// 6 | public partial class HardCodeWaveProgressBar 7 | { 8 | public HardCodeWaveProgressBar() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/WaveProgressBars/WaveProgressBar.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace WpfDesignAndAnimationLab.Demos.WaveProgressBars 6 | { 7 | /// 8 | /// thanks https://www.cnblogs.com/h82258652/p/16098909.html 9 | /// 10 | [TemplatePart(Name = RootTemplateName, Type = typeof(FrameworkElement))] 11 | public class WaveProgressBar : Control 12 | { 13 | private const string RootTemplateName = "Root"; 14 | 15 | public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register( 16 | nameof(Progress), typeof(double), typeof(WaveProgressBar), new PropertyMetadata(0d, OnProgressChanged)); 17 | 18 | private Storyboard _progressStoryboard; 19 | 20 | public WaveProgressBar() => DefaultStyleKey = typeof(WaveProgressBar); 21 | 22 | public double Progress 23 | { 24 | get => (double)GetValue(ProgressProperty); 25 | set => SetValue(ProgressProperty, value); 26 | } 27 | 28 | public override void OnApplyTemplate() 29 | { 30 | var root = (FrameworkElement)GetTemplateChild(RootTemplateName); 31 | _progressStoryboard = root.Resources["ProgressStoryboard"] as Storyboard; 32 | 33 | PlayAnimation(true); 34 | } 35 | 36 | private static void OnProgressChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 37 | { 38 | var obj = (WaveProgressBar)d; 39 | obj.PlayAnimation(false); 40 | } 41 | 42 | private void PlayAnimation(bool isInit) 43 | { 44 | if (_progressStoryboard == null) 45 | { 46 | return; 47 | } 48 | 49 | var targetY = 100 * (1 - Progress); 50 | _progressStoryboard.Stop(); 51 | (_progressStoryboard.Children[0] as PointAnimation).To = new Point(0, targetY); 52 | (_progressStoryboard.Children[1] as PointAnimation).To = new Point(35, targetY); 53 | (_progressStoryboard.Children[2] as PointAnimation).To = new Point(65, targetY); 54 | (_progressStoryboard.Children[3] as PointAnimation).To = new Point(100, targetY); 55 | _progressStoryboard.Begin(); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/WaveProgressBars/WaveProgressBarUsingControlTemplate.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.WaveProgressBars 2 | { 3 | /// 4 | /// WaveProgressBarUsingControlTemplate.xaml 的交互逻辑 5 | /// 6 | public partial class WaveProgressBarUsingControlTemplate 7 | { 8 | public WaveProgressBarUsingControlTemplate() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Waves/SimpleBezierWave.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Waves 2 | { 3 | /// 4 | /// SimpleBezierWave.xaml 的交互逻辑 5 | /// 6 | public partial class SimpleBezierWave 7 | { 8 | public SimpleBezierWave() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Waves/SimpleBubbleWaves.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Waves 2 | { 3 | /// 4 | /// https://codepen.io/Chokcoco/pen/awxYWZ 5 | /// 6 | public partial class SimpleBubbleWaves 7 | { 8 | public SimpleBubbleWaves() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Waves/SimpleWaves.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Demos.Waves 2 | { 3 | /// 4 | /// https://codepen.io/goodkatz/pen/LYPGxQz 5 | /// 6 | public partial class SimpleWaves 7 | { 8 | public SimpleWaves() => InitializeComponent(); 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Demos/Wobble/WobbleDemo1.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace WpfDesignAndAnimationLab.Demos.Wobble 17 | { 18 | /// 19 | /// Interaction logic for ActivationDemo1.xaml 20 | /// 21 | public partial class WobbleDemo1 22 | { 23 | public WobbleDemo1() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void OnLeft(object sender, RoutedEventArgs e) 29 | { 30 | WobbleContentControl.Direction = Controls.Direction.Left; 31 | WobbleContentControl.Wobble(); 32 | } 33 | 34 | private void OnUp(object sender, RoutedEventArgs e) 35 | { 36 | WobbleContentControl.Direction = Controls.Direction.Up; 37 | WobbleContentControl.Wobble(); 38 | } 39 | 40 | private void OnRight(object sender, RoutedEventArgs e) 41 | { 42 | WobbleContentControl.Direction = Controls.Direction.Right; 43 | WobbleContentControl.Wobble(); 44 | } 45 | 46 | private void OnDown(object sender, RoutedEventArgs e) 47 | { 48 | WobbleContentControl.Direction = Controls.Direction.Down; 49 | WobbleContentControl.Wobble(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Extensions/LightenExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Markup; 3 | using System.Windows.Media; 4 | using WpfDesignAndAnimationLab.Media; 5 | 6 | namespace WpfDesignAndAnimationLab.Extensions 7 | { 8 | [MarkupExtensionReturnType(typeof(SolidColorBrush))] 9 | public class LightenExtension : MarkupExtension 10 | { 11 | public double Amount { get; set; } 12 | public SolidColorBrush Source { get; set; } 13 | 14 | public override object ProvideValue(IServiceProvider serviceProvider) => 15 | new SolidColorBrush(new HslColor(Source.Color).Lighten(Amount).ToRgb()); 16 | } 17 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Infrastructure/DemoContainer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | namespace WpfDesignAndAnimationLab.Infrastructure 7 | { 8 | /// 9 | /// DemoContainer.xaml 的交互逻辑 10 | /// 11 | public partial class DemoContainer : UserControl 12 | { 13 | public DemoContainer(ExampleDefinition exampleDefinition) 14 | { 15 | InitializeComponent(); 16 | ExampleDefinition = exampleDefinition; 17 | TitleElement.Text = exampleDefinition.Name; 18 | DemoItemsElement.ItemsSource = exampleDefinition.Items; 19 | DemoItemsElement.SelectedItem = exampleDefinition.Items.FirstOrDefault(); 20 | if (exampleDefinition.Items.Count() == 1) 21 | { 22 | ItemsSperator.Visibility = Visibility.Collapsed; 23 | DemoItemsElement.Visibility = Visibility.Collapsed; 24 | } 25 | } 26 | 27 | public ExampleDefinition ExampleDefinition { get; } 28 | 29 | private void DemoItemsElement_SelectionChanged(object sender, SelectionChangedEventArgs e) 30 | { 31 | if (DemoItemsElement.SelectedItem is not ExampleDefinitionItem item) 32 | { 33 | return; 34 | } 35 | 36 | var demo = Activator.CreateInstance(item.Control); 37 | ContentControl.Content = demo; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Infrastructure/DemoPage.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace WpfDesignAndAnimationLab 4 | { 5 | public class DemoPage : HeaderedContentControl 6 | { 7 | public DemoPage() => DefaultStyleKey = typeof(DemoPage); 8 | } 9 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Infrastructure/ExampleDefinition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace WpfDesignAndAnimationLab.Infrastructure 5 | { 6 | public class ExampleDefinition 7 | { 8 | public ExampleDefinition(string name, Uri sourceCodeUri, params ExampleDefinitionItem[] items) 9 | { 10 | Name = name; 11 | ShourceCodeUri = sourceCodeUri; 12 | Items = items; 13 | } 14 | 15 | public ExampleDefinition(string name, Uri sourceCodeUri, Type control) : this(name, sourceCodeUri, 16 | new ExampleDefinitionItem(name, control)) 17 | { 18 | } 19 | 20 | public IEnumerable Items { get; } 21 | public string Name { get; } 22 | 23 | public Uri ShourceCodeUri { get; } 24 | 25 | public override string ToString() => Name; 26 | } 27 | 28 | public class ExampleDefinitionItem 29 | { 30 | public ExampleDefinitionItem(string name, Type control) 31 | { 32 | Name = name; 33 | Control = control; 34 | } 35 | 36 | public Type Control { get; } 37 | public string Name { get; } 38 | } 39 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using WpfDesignAndAnimationLab.Infrastructure; 4 | 5 | namespace WpfDesignAndAnimationLab 6 | { 7 | /// 8 | /// Interaction logic for MainWindow.xaml 9 | /// 10 | public partial class MainWindow : Window 11 | { 12 | public MainWindow() => InitializeComponent(); 13 | 14 | private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) 15 | { 16 | if (DemoItemsControl.SelectedItem is not ExampleDefinition exampleDefinition) 17 | { 18 | return; 19 | } 20 | 21 | var container = new DemoContainer(exampleDefinition); 22 | DemoContentControl.Content = container; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Media/Direction.cs: -------------------------------------------------------------------------------- 1 | namespace WpfDesignAndAnimationLab.Media 2 | { 3 | public enum Direction 4 | { 5 | Left, 6 | Up, 7 | Right, 8 | Down 9 | } 10 | } -------------------------------------------------------------------------------- /WpfDesignAndAnimationLab/Media/ShapeStrokeHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace WpfDesignAndAnimationLab.Media 4 | { 5 | public class ShapeStrokeHelper : DependencyObject 6 | { 7 | /// 8 | /// 标识 AttachedShape 依赖属性。 9 | /// 10 | public static readonly DependencyProperty AttachedShapeProperty = 11 | DependencyProperty.Register(nameof(AttachedShape), typeof(DependencyObject), typeof(ShapeStrokeHelper), 12 | new PropertyMetadata(default(DependencyObject), OnAttachedShapeChanged)); 13 | 14 | /// 15 | /// 获取或设置AttachedShape的值 16 | /// 17 | public DependencyObject AttachedShape 18 | { 19 | get => (DependencyObject)GetValue(AttachedShapeProperty); 20 | set => SetValue(AttachedShapeProperty, value); 21 | } 22 | 23 | /// 24 | /// AttachedShape 属性更改时调用此方法。 25 | /// 26 | /// AttachedShape 属性的旧值。 27 | /// AttachedShape 属性的新值。 28 | protected virtual void OnAttachedShapeChanged(DependencyObject oldValue, DependencyObject newValue) 29 | { 30 | } 31 | 32 | private static void OnAttachedShapeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) 33 | { 34 | var oldValue = (DependencyObject)args.OldValue; 35 | var newValue = (DependencyObject)args.NewValue; 36 | if (oldValue == newValue) 37 | { 38 | return; 39 | } 40 | 41 | var target = obj as ShapeStrokeHelper; 42 | target?.OnAttachedShapeChanged(oldValue, newValue); 43 | } 44 | } 45 | } --------------------------------------------------------------------------------