超炫酷的WPF实现Loading控件效果

2019-12-30 11:11:34刘景俊
  • <system:Double x:Key = "ParticleEndAngle2">270</system:Double>  <system:TimeSpan x:Key = "ParticleBeginTime2">00:00:00.751</system:TimeSpan> 
  • <Duration x:Key = "ParticleDuration2">00:00:00.300</Duration>   
  • <!-- Particle Position & Timing 3 -->  <system:Double x:Key = "ParticleBeginAngle3">270</system:Double> 
  • <system:Double x:Key = "ParticleEndAngle3">360</system:Double>  <system:TimeSpan x:Key = "ParticleBeginTime3">00:00:01.052</system:TimeSpan> 
  • <Duration x:Key = "ParticleDuration3">00:00:00.750</Duration>   
  • <Style x:Key = "EllipseStyle" TargetType = "Ellipse">  <Setter Property = "Width" Value = "{StaticResource ParticleRadius}"/> 
  • <Setter Property = "Height" Value = "{StaticResource ParticleRadius}"/>  <Setter Property = "Fill" Value = "{StaticResource ParticleColor}"/> 
  • <Setter Property = "RenderTransformOrigin" Value = "0.5, 0.5"/>  <Setter Property = "Opacity" Value = "{StaticResource ParticleOpacity}"/> 
  • </Style>  </Grid.Resources> 
  • <Canvas Width = "1" Height = "1" Margin="0,0,0,0">  <Canvas.Triggers> 
  • <EventTrigger RoutedEvent = "Canvas.Loaded">  <EventTrigger.Actions> 
  • <BeginStoryboard>  <Storyboard 
  •   BeginTime = "{StaticResource StoryBoardBeginTimeP0}" 
  • Duration = "{StaticResource StoryBoardDuration}"  RepeatBehavior = "Forever"> 
  • <DoubleAnimation  Storyboard.TargetName = "p0" 
  • Storyboard.TargetProperty = "(UIElement.RenderTransform).(RotateTransform.Angle)"  From = "{StaticResource ParticleBeginAngle1}" 
  • To = "{StaticResource ParticleEndAngle1}"  BeginTime = "{StaticResource ParticleBeginTime1}"