CSharp examples for Windows.UI.Xaml.Media.Animation:Animation
Create Translate Y Fade In Effects
using Windows.UI.Xaml.Media.Animation; using Windows.UI.Xaml; using Windows.UI; using System;//from w ww . ja v a 2 s . co m public class Main{ public static Storyboard CreateTranslateYFadeInEffects(UIElement target, TimeSpan beginTime, Duration duration, double translateFrom, double translateTo, double opacityFrom = 0, double opacityTo = 1) { var t1 = new DoubleAnimation { BeginTime = beginTime, Duration = duration, To = opacityTo, From = opacityFrom }; Storyboard.SetTarget(t1, target); Storyboard.SetTargetProperty(t1, "Opacity"); var translateY = new DoubleAnimation { BeginTime = beginTime, Duration = duration, From = translateFrom, To = translateTo, }; Storyboard.SetTarget(translateY, target); Storyboard.SetTargetProperty(translateY, "(UIElement.RenderTransform).(CompositeTransform.TranslateY)"); var sb = new Storyboard(); sb.Children.Add(t1); sb.Children.Add(translateY); return sb; } }