wpf Loading动画 AkeemLoading


一、样式1

1、效果预览

2、新建自定义控件

"Akeem.AkeemLoding"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
        "#FF007BE5" x:Key="CirclesColor" />
        
    
    "Transparent" Name="LayoutRoot">
        
            "SpinnerScale" ScaleX="1.0" ScaleY="1.0" />
        
        "120" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" Width="120">
            
                "FrameworkElement.Loaded">
                    
                        
                            
                                "Forever" AccelerationRatio="0.1" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse1" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.2" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse2" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.3" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse3" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.4" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse4" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.5" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse5" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.6" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse6" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.7" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse7" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.8" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse8" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="0.9" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse9" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360"  />
                                "Forever" AccelerationRatio="1" SpeedRatio="4" Duration="0:0:0:04" From="0" Storyboard.TargetName="Ellipse10" Storyboard.TargetProperty="(RotateTransform.Angle)" To="360" />
                             
                        
                    
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse1" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse2" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse3" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse4" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse5" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse6" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse7" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse8" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse9" Angle="0" />
                
            
            "0.455,2.727" 
                     Canvas.Left="50" 
                     Fill="{StaticResource CirclesColor}" 
                     Height="22" 
                     Opacity="1" 
                     Stretch="Fill" 
                     Width="22" Canvas.Top="0" >
                
                    "Ellipse10" Angle="0" />
                
            
            
        
        "Loading..." x:Name="text_Loading" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FFE3953D" FontWeight="Bold" />
    

 3、用法

二、样式2

1、效果预览

2、新建自定义控件

"Akeem.AkeemLoading"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
        "#FF007BE5" x:Key="CirclesColor" />
    
    "Transparent" Name="LayoutRoot">
        "Center" Height="120" Width="150" RenderTransformOrigin="0,0" VerticalAlignment="Center" >
            
                "FrameworkElement.Loaded">
                    
                        
                            
                                "Forever" BeginTime="0:0:0" Storyboard.TargetName="scale1" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                                "Forever" BeginTime="0:0:0.1" Storyboard.TargetName="scale2" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                                "Forever" BeginTime="0:0:0.2" Storyboard.TargetName="scale3" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                                "Forever" BeginTime="0:0:0.3" Storyboard.TargetName="scale4" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                                "Forever" BeginTime="0:0:0.2" Storyboard.TargetName="scale5" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                                "Forever" BeginTime="0:0:0.1" Storyboard.TargetName="scale6" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                                "Forever" BeginTime="0:0:0.0" Storyboard.TargetName="scale7" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" Duration="0:0:1">
                                    "1" KeyTime="0%" />
                                    "0.3" KeyTime="50%" />
                                    "1" KeyTime="100%" />
                                
                             
                        
                    
                
            
            "Horizontal" >
                
                    
                
                "{StaticResource CirclesColor}" >
                    
                        "scale1" ScaleY="1"/>
                    
                
                "{StaticResource CirclesColor}">
                    
                        "scale2" ScaleY="1"/>
                    
                
                "{StaticResource CirclesColor}">
                    
                        "scale3" ScaleY="1"/>
                    
                
                "{StaticResource CirclesColor}">
                    
                        "scale4" ScaleY="1"/>
                    
                
                "{StaticResource CirclesColor}">
                    
                        "scale5" ScaleY="1"/>
                    
                
                "{StaticResource CirclesColor}">
                    
                        "scale6" ScaleY="1"/>
                    
                
                "{StaticResource CirclesColor}">
                    
                        "scale7" ScaleY="1"/>
                    
                
                
            
        
    

3、用法

原文:https://www.cnblogs.com/zisai/p/11095956.html