CSharp examples for Windows.UI.Xaml.Media.Animation:Animation
Create Fade Out Effects
using Windows.UI.Xaml.Media.Animation; using Windows.UI.Xaml; using Windows.UI; using System;/*from w w w .ja v a 2s .c o m*/ public class Main{ public static Storyboard CreateFadeOutEffects(DependencyObject target, TimeSpan beginTime, TimeSpan duration, double from, double to) { var t1 = new DoubleAnimation { BeginTime = beginTime, Duration = duration, To = to }; if (from > 0) { t1.From = from; } Storyboard.SetTarget(t1, target); Storyboard.SetTargetProperty(t1, "Opacity"); var sb = new Storyboard(); sb.Children.Add(t1); return sb; } public static Storyboard CreateFadeOutEffects(UIElement target, TimeSpan beginTime, TimeSpan duration) { return CreateFadeOutEffects(target, beginTime, duration, target.Opacity, 0); } }