CSharp examples for Windows.UI.Xaml.Media.Animation:Animation
Create Show Storyboard
using System.Windows.Media.Animation; using System.Windows; using System;//www . ja v a2 s . com public class Main{ public static Storyboard CreateShowStoryboard(UIElement target, TimeSpan duration) { var opacityAnimation = new DoubleAnimation { To = 1.0, Duration = duration, EasingFunction = new CubicEase {EasingMode = EasingMode.EaseOut} }; Storyboard.SetTarget(opacityAnimation, target); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("Opacity")); var visibilityAnimation = new ObjectAnimationUsingKeyFrames(); visibilityAnimation.KeyFrames.Add(new DiscreteObjectKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero), Value = Visibility.Visible }); Storyboard.SetTarget(visibilityAnimation, target); Storyboard.SetTargetProperty(visibilityAnimation, new PropertyPath("Visibility")); var sb = new Storyboard(); sb.Children.Add(opacityAnimation); sb.Children.Add(visibilityAnimation); return sb; } }