private void ShowImage(Image img, bool enableFading) { if (enableFading) { DoubleAnimation animation = new DoubleAnimation { From = new double?(img.Opacity), To = 1.0, Duration = TimeSpan.FromSeconds(0.5) }; animation.SetValue(Storyboard.TargetPropertyProperty, "Opacity"); Storyboard storyboard = new Storyboard(); storyboard.Children.Add(animation); Storyboard.SetTarget(animation, img); storyboard.Completed += (s, e) => { DispatchedHandler handler = new DispatchedHandler(delegate { base.OnProgress(this.GetProgress()); }); base.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, handler); }; storyboard.Begin(); } else { img.Opacity = 1.0; } base.OnProgress(this.GetProgress()); //到处都有你的身影 }
private void Border_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) { if (this.overlay != null) { var ani = new DoubleAnimation() { From = 0.0, To = 1.0, Duration = new Duration(TimeSpan.FromSeconds(1.5)) }; var storyBoard = new Storyboard(); storyBoard.Children.Add(ani); Storyboard.SetTarget(ani, overlay); ani.SetValue(Storyboard.TargetPropertyProperty, "Opacity"); storyBoard.Begin(); } }
private void SetupIndicationArc() { var indicationArcRadius = Radius - OuterArcThickness - IndicationArcDistanceFromEdge; IndicationArc.Size = new Size(indicationArcRadius, indicationArcRadius); double startAngle = (StartAngle + .10 * Angle) * (Math.PI / 180), endAngle = (StartAngle + .90 * Angle) * (Math.PI / 180); double startX = Radius + indicationArcRadius * Math.Sin(startAngle), startY = Radius - indicationArcRadius * Math.Cos(startAngle), endX = Radius + indicationArcRadius * Math.Sin(endAngle), endY = Radius - indicationArcRadius * Math.Cos(endAngle); IndicationArcPathFigure.StartPoint = new Point(startX, startY); IndicationArc.Point = new Point(endX, endY); IndicationArcPath.StrokeThickness = IndicationArcStrokeThickness; IndicationArcPath.Stroke = new SolidColorBrush(IndicationArcColor); // make all arcs initiall invisibile IndicationArcPath.Opacity = 0.0; var appearAnimation = new DoubleAnimation() { From = 0.0, To = 1.0, }; appearAnimation.SetValue(Storyboard.TargetNameProperty, "IndicationArcPath"); appearAnimation.SetValue(Storyboard.TargetPropertyProperty, "Opacity"); InnerReleasedStoryBoard.Stop(); InnerReleasedStoryBoard.Children.Add(appearAnimation); }
/// <summary> /// Briefly shows the overlay, to indicate floating ability. /// </summary> private void FlashOverlay() { if (this.overlay != null) { var ani = new DoubleAnimation() { From = 0.0, To = 1.0, Duration = new Duration(TimeSpan.FromSeconds(1.0)), AutoReverse = true }; var storyBoard = new Storyboard(); storyBoard.Children.Add(ani); Storyboard.SetTarget(ani, overlay); ani.SetValue(Storyboard.TargetPropertyProperty, "Opacity"); storyBoard.Begin(); } }